本文整理汇总了PHP中Fisharebest\Webtrees\Database::updateSchema方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::updateSchema方法的具体用法?PHP Database::updateSchema怎么用?PHP Database::updateSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Database
的用法示例。
在下文中一共展示了Database::updateSchema方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Create a new module.
*
* @param string $directory Where is this module installed
*/
public function __construct($directory)
{
parent::__construct($directory);
// Create/update the database tables.
// NOTE: if we want to set any module-settings, we'll need to move this.
Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
}
示例2: validatePrerequisites
/**
* {@inheritDoc}
* @see \MyArtJaub\Webtrees\Module\DependentInterface::validatePrerequisites()
*/
public function validatePrerequisites()
{
try {
Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
return true;
} catch (\Exception $ex) {
}
return false;
}
示例3: validatePrerequisites
/**
* {@inhericDoc}
* @see \MyArtJaub\Webtrees\Module\DependentInterface::validatePrerequisites()
*/
public function validatePrerequisites()
{
try {
Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
return !is_null(Module::getModuleByName(Constants::MODULE_MAJ_SOSA_NAME));
} catch (\Exception $ex) {
}
return false;
}
示例4: addcslashes
echo '<h2>', I18N::translate('System settings'), '</h2>', '<h3>', I18N::translate('Administrator account'), '</h3>', '<p>', I18N::translate('You need to set up an administrator account. This account can control all aspects of this webtrees installation. Please choose a strong password.'), '</p>', '<fieldset><legend>', I18N::translate('Administrator account'), '</legend>', '<table border="0"><tr><td>', I18N::translate('Your name'), '</td><td>', '<input type="text" name="wtname" value="', Filter::escapeHtml($_POST['wtname']), '" autofocus></td><td>', I18N::translate('This is your real name, as you would like it displayed on screen.'), '</td></tr><tr><td>', I18N::translate('Login ID'), '</td><td>', '<input type="text" name="wtuser" value="', Filter::escapeHtml($_POST['wtuser']), '"></td><td>', I18N::translate('You will use this to login to webtrees.'), '</td></tr><tr><td>', I18N::translate('Password'), '</td><td>', '<input type="password" name="wtpass" value="', Filter::escapeHtml($_POST['wtpass']), '"></td><td>', I18N::translate('This must be at least six characters long. It is case-sensitive.'), '</td></tr><tr><td>', ' ', '</td><td>', '<input type="password" name="wtpass2" value="', Filter::escapeHtml($_POST['wtpass2']), '"></td><td>', I18N::translate('Type your password again, to make sure you have typed it correctly.'), '</td></tr><tr><td>', I18N::translate('Email address'), '</td><td>', '<input type="email" name="wtemail" value="', Filter::escapeHtml($_POST['wtemail']), '"></td><td>', I18N::translate('This email address will be used to send password reminders, website notifications, and messages from other family members who are registered on the website.'), '</td></tr><tr><td>', '</td></tr></table>', '</fieldset>', '<br><hr><input type="submit" id="btncontinue" value="', I18N::translate('continue'), '">', '</form>', '</body></html>';
return;
} else {
// Copy these values through to the next step
echo '<input type="hidden" name="wtname" value="', Filter::escapeHtml($_POST['wtname']), '">';
echo '<input type="hidden" name="wtuser" value="', Filter::escapeHtml($_POST['wtuser']), '">';
echo '<input type="hidden" name="wtpass" value="', Filter::escapeHtml($_POST['wtpass']), '">';
echo '<input type="hidden" name="wtpass2" value="', Filter::escapeHtml($_POST['wtpass2']), '">';
echo '<input type="hidden" name="wtemail" value="', Filter::escapeHtml($_POST['wtemail']), '">';
}
////////////////////////////////////////////////////////////////////////////////
// Step six We have a database connection and a writable folder. Do it!
////////////////////////////////////////////////////////////////////////////////
try {
// Create/update the database tables.
Database::updateSchema('\\Fisharebest\\Webtrees\\Schema', 'WT_SCHEMA_VERSION', 30);
// Create the admin user
$admin = User::create($_POST['wtuser'], $_POST['wtname'], $_POST['wtemail'], $_POST['wtpass']);
$admin->setPreference('canadmin', '1');
$admin->setPreference('language', WT_LOCALE);
$admin->setPreference('verified', '1');
$admin->setPreference('verified_by_admin', '1');
$admin->setPreference('auto_accept', '0');
$admin->setPreference('visibleonline', '1');
// Write the config file. We already checked that this would work.
$config_ini_php = '; <' . '?php exit; ?' . '> DO NOT DELETE THIS LINE' . PHP_EOL . 'dbhost="' . addcslashes($_POST['dbhost'], '"') . '"' . PHP_EOL . 'dbport="' . addcslashes($_POST['dbport'], '"') . '"' . PHP_EOL . 'dbuser="' . addcslashes($_POST['dbuser'], '"') . '"' . PHP_EOL . 'dbpass="' . addcslashes($_POST['dbpass'], '"') . '"' . PHP_EOL . 'dbname="' . addcslashes($_POST['dbname'], '"') . '"' . PHP_EOL . 'tblpfx="' . addcslashes($_POST['tblpfx'], '"') . '"' . PHP_EOL;
file_put_contents(WT_DATA_DIR . 'config.ini.php', $config_ini_php);
// Done - start using webtrees!
echo '<script>document.location=document.location;</script>';
echo '</form></body></html>';
} catch (PDOException $ex) {
示例5: __construct
/**
* Create a new module.
*
* @param string $directory Where is this module installed
*/
public function __construct($directory)
{
parent::__construct($directory);
// Create/update the database tables.
Database::updateSchema('\\Fisharebest\\Webtrees\\Module\\FamilyTreeNews\\Schema', 'NB_SCHEMA_VERSION', 3);
}
示例6: createMap
/**
* Called by placelist.php
*
* @param string $placelevels
*/
public function createMap($placelevels)
{
global $level, $levelm, $plzoom, $controller, $WT_TREE;
Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
$STREETVIEW = $this->getSetting('GM_USE_STREETVIEW');
$parent = Filter::getArray('parent');
// create the map
echo '<table style="margin:20px auto 0 auto;"><tr valign="top"><td>';
//<!-- start of map display -->
echo '<table><tr valign="top">';
echo '<td class="center" width="200px">';
$levelm = $this->setLevelMap($level, $parent);
$latlng = Database::prepare("SELECT pl_place, pl_id, pl_lati, pl_long, pl_zoom, sv_long, sv_lati, sv_bearing, sv_elevation, sv_zoom FROM `##placelocation` WHERE pl_id=?")->execute(array($levelm))->fetch(PDO::FETCH_ASSOC);
if ($STREETVIEW && $level != 0) {
echo '<div id="place_map" style="margin-top:20px; border:1px solid gray; width: ', $this->getSetting('GM_PH_XSIZE'), 'px; height: ', $this->getSetting('GM_PH_YSIZE'), 'px; ';
} else {
echo '<div id="place_map" style="border:1px solid gray; width:', $this->getSetting('GM_PH_XSIZE'), 'px; height:', $this->getSetting('GM_PH_YSIZE'), 'px; ';
}
echo "\"><i class=\"icon-loading-large\"></i></div>";
echo '</td>';
echo '<script src="', $this->googleMapsScript(), '"></script>';
$plzoom = $latlng['pl_zoom'];
// Map zoom level
if (Auth::isAdmin()) {
$placecheck_url = 'module.php?mod=googlemap&mod_action=admin_placecheck';
if ($parent && isset($parent[0])) {
$placecheck_url .= '&country=' . $parent[0];
if (isset($parent[1])) {
$placecheck_url .= '&state=' . $parent[1];
}
}
$adminplaces_url = 'module.php?mod=googlemap&mod_action=admin_places';
if ($latlng && isset($latlng['pl_id'])) {
$adminplaces_url .= '&parent=' . $latlng['pl_id'];
}
echo '</tr><tr><td>';
echo '<a href="module.php?mod=googlemap&mod_action=admin_config">', I18N::translate('Google Maps™ preferences'), '</a>';
echo ' | ';
echo '<a href="' . $adminplaces_url . '">', I18N::translate('Geographic data'), '</a>';
echo ' | ';
echo '<a href="' . $placecheck_url . '">', I18N::translate('Place check'), '</a>';
if (Module::getModuleByName('batch_update')) {
$placelevels = preg_replace('/, ' . I18N::translate('unknown') . '/', ', ', $placelevels);
// replace ", unknown" with ", "
$placelevels = substr($placelevels, 2);
// remove the leading ", "
if ($placelevels) {
$batchupdate_url = 'module.php?mod=batch_update&mod_action=admin_batch_update&plugin=BatchUpdateSearchReplacePlugin&method=exact&ged=' . $WT_TREE->getNameHtml() . '&search=' . urlencode($placelevels);
// exact match
echo ' | ';
echo '<a href="' . $batchupdate_url . '">', I18N::translate('Batch update'), '</a>';
}
}
}
echo '</td></tr></table>';
echo '</td>';
echo '<td style="margin-left:15px; float:right;">';
if ($STREETVIEW) {
$controller->addInlineJavascript('
function update_sv_params(placeid) {
var svlati = document.getElementById("sv_latiText").value.slice(0, -1);
var svlong = document.getElementById("sv_longText").value.slice(0, -1);
var svbear = document.getElementById("sv_bearText").value.slice(0, -1);
var svelev = document.getElementById("sv_elevText").value.slice(0, -1);
var svzoom = document.getElementById("sv_zoomText").value;
win03 = window.open("module.php?mod=googlemap&mod_action=places_edit&action=update_sv_params&placeid="+placeid+"&svlati="+svlati+"&svlong="+svlong+"&svbear="+svbear+"&svelev="+svelev+"&svzoom="+svzoom, "win03", indx_window_specs);
if (window.focus) {win03.focus();}
}
');
global $pl_lati, $pl_long;
if ($level >= 1) {
$pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlng['pl_lati']);
// WT_placelocation lati
$pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlng['pl_long']);
// WT_placelocation long
// Check if Streetview location parameters are stored in database
$placeid = $latlng['pl_id'];
// Placelocation place id
$sv_lat = $latlng['sv_lati'];
// StreetView Point of View Latitude
$sv_lng = $latlng['sv_long'];
// StreetView Point of View Longitude
$sv_dir = $latlng['sv_bearing'];
// StreetView Point of View Direction (degrees from North)
$sv_pitch = $latlng['sv_elevation'];
// StreetView Point of View Elevation (+90 to -90 degrees (+=down, -=up)
$sv_zoom = $latlng['sv_zoom'];
// StreetView Point of View Zoom (0, 1, 2 or 3)
// Check if Street View Lati/Long are the default of 0, if so use regular Place Lati/Long to set an initial location for the panda
if ($latlng['sv_lati'] == 0 && $latlng['sv_long'] == 0) {
$sv_lat = $pl_lati;
$sv_lng = $pl_long;
}
?>
<div>
//.........这里部分代码省略.........
示例7: createMap
/**
* Called by placelist.php
*/
public function createMap()
{
global $level, $levelm, $plzoom, $WT_TREE;
Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
$STREETVIEW = (bool) $this->getSetting('GM_USE_STREETVIEW');
$parent = Filter::getArray('parent');
$levelm = $this->setLevelMap($level, $parent);
$latlng = Database::prepare("SELECT pl_place, pl_id, pl_lati, pl_long, pl_zoom, sv_long, sv_lati, sv_bearing, sv_elevation, sv_zoom FROM `##placelocation` WHERE pl_id=?")->execute(array($levelm))->fetch(PDO::FETCH_ASSOC);
echo '<table style="margin:auto; border-collapse: collapse;">';
echo '<tr style="vertical-align:top;"><td>';
if ($STREETVIEW && $level != 0) {
// Leave space for the Street View buttons, so that the maps align vertically
echo '<div id="place_map" style="margin-top:25px; border:1px solid gray; width: ', $this->getSetting('GM_PH_XSIZE'), 'px; height: ', $this->getSetting('GM_PH_YSIZE'), 'px; ';
} else {
echo '<div id="place_map" style="border:1px solid gray; width:', $this->getSetting('GM_PH_XSIZE'), 'px; height:', $this->getSetting('GM_PH_YSIZE'), 'px; ';
}
echo '"><i class="icon-loading-large"></i></div>';
echo '<script src="', $this->googleMapsScript(), '"></script>';
$plzoom = $latlng['pl_zoom'];
// Map zoom level
if (Auth::isAdmin()) {
$placecheck_url = 'module.php?mod=googlemap&mod_action=admin_placecheck';
if ($parent && isset($parent[0])) {
$placecheck_url .= '&country=' . $parent[0];
if (isset($parent[1])) {
$placecheck_url .= '&state=' . $parent[1];
}
}
$adminplaces_url = 'module.php?mod=googlemap&mod_action=admin_places';
if ($latlng && isset($latlng['pl_id'])) {
$adminplaces_url .= '&parent=' . $latlng['pl_id'];
}
$update_places_url = 'admin_trees_places.php?ged=' . $WT_TREE->getNameHtml() . '&search=' . urlencode(implode(', ', array_reverse($parent)));
echo '<div class="gm-options">';
echo '<a href="module.php?mod=googlemap&mod_action=admin_config">', I18N::translate('Google Maps™ preferences'), '</a>';
echo ' | <a href="' . $adminplaces_url . '">' . I18N::translate('Geographic data') . '</a>';
echo ' | <a href="' . $placecheck_url . '">' . I18N::translate('Place check') . '</a>';
echo ' | <a href="' . $update_places_url . '">' . I18N::translate('Update place names') . '</a>';
echo '</div>';
}
echo '</td>';
if ($STREETVIEW) {
echo '<td>';
global $pl_lati, $pl_long;
if ($level >= 1) {
$pl_lati = strtr($latlng['pl_lati'], array('N' => '', 'S' => '-', ',' => '.'));
// WT_placelocation lati
$pl_long = strtr($latlng['pl_long'], array('E' => '', 'W' => '-', ',' => '.'));
// WT_placelocation long
// Check if Streetview location parameters are stored in database
$placeid = $latlng['pl_id'];
// Placelocation place id
$sv_lat = $latlng['sv_lati'];
// StreetView Point of View Latitude
$sv_lng = $latlng['sv_long'];
// StreetView Point of View Longitude
$sv_dir = $latlng['sv_bearing'];
// StreetView Point of View Direction (degrees from North)
$sv_pitch = $latlng['sv_elevation'];
// StreetView Point of View Elevation (+90 to -90 degrees (+=down, -=up)
$sv_zoom = $latlng['sv_zoom'];
// StreetView Point of View Zoom (0, 1, 2 or 3)
// Check if Street View Lati/Long are the default of 0, if so use regular Place Lati/Long to set an initial location for the panda
if ($latlng['sv_lati'] == 0 && $latlng['sv_long'] == 0) {
$sv_lat = $pl_lati;
$sv_lng = $pl_long;
}
$frameheight = $this->getSetting('GM_PH_YSIZE') + 35;
// Add height of buttons
?>
<iframe class="gm-streetview-frame" style="height: <?php
echo $frameheight;
?>
px;" src="module.php?mod=googlemap&mod_action=wt_street_view&x=<?php
echo $sv_lng;
?>
&y=<?php
echo $sv_lat;
?>
&z=18&t=2&c=1&s=1&b=<?php
echo $sv_dir;
?>
&p=<?php
echo $sv_pitch;
?>
&m=<?php
echo $sv_zoom;
?>
&j=1&k=1&v=1"></iframe>
<?php
if (Auth::isAdmin()) {
?>
<div class="gm-streetview-parameters">
<form method="post" action="module.php?mod=googlemap&mod_action=places_edit">
<?php
echo Filter::getCsrf();
?>
//.........这里部分代码省略.........
示例8: getMenu
/** {@inheritdoc} */
public function getMenu()
{
global $controller;
if (!Auth::isSearchEngine()) {
Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
static $menu;
// Function has already run
if ($menu !== null && count($menu->getSubmenus()) > 0) {
return $menu;
}
$FTV_SETTINGS = unserialize($this->getSetting('FTV_SETTINGS'));
if (!empty($FTV_SETTINGS)) {
foreach ($FTV_SETTINGS as $FTV_ITEM) {
if ($FTV_ITEM['TREE'] == $this->tree_id && !empty($FTV_ITEM['PID']) && $FTV_ITEM['ACCESS_LEVEL'] >= Auth::accessLevel($this->tree)) {
$FTV_GED_SETTINGS[] = $FTV_ITEM;
}
}
if (!empty($FTV_GED_SETTINGS)) {
if (Theme::theme()->themeId() !== '_administration') {
// load the module stylesheets
echo $this->module()->getStylesheet();
// add javascript files and scripts
$this->module()->includeJs($controller, 'menu');
if (WT_SCRIPT_NAME === 'individual.php') {
$this->module()->includeJs($controller, 'tab');
}
}
$tree_name = Filter::escapeUrl($this->tree->getName());
$menu = new Menu(I18N::translate('Family tree overview'), 'module.php?mod=' . $this->getName() . '&mod_action=page&rootid=' . $FTV_GED_SETTINGS[0]['PID'] . '&ged=' . $tree_name, 'menu-fancy_treeview');
foreach ($FTV_GED_SETTINGS as $FTV_ITEM) {
$record = Individual::getInstance($FTV_ITEM['PID'], $this->tree);
if ($record && $record->canShowName()) {
if ($this->module()->options('use_fullname') == true) {
$submenu = new Menu(I18N::translate('Descendants of %s', $record->getFullName()), 'module.php?mod=' . $this->getName() . '&mod_action=page&rootid=' . $FTV_ITEM['PID'] . '&ged=' . $tree_name, 'menu-fancy_treeview-' . $FTV_ITEM['PID']);
} else {
$submenu = new Menu(I18N::translate('Descendants of the %s family', $FTV_ITEM['SURNAME']), 'module.php?mod=' . $this->getName() . '&mod_action=page&rootid=' . $FTV_ITEM['PID'] . '&ged=' . $tree_name, 'menu-fancy_treeview-' . $FTV_ITEM['PID']);
}
$menu->addSubmenu($submenu);
}
}
if (count($menu->getSubmenus()) > 0) {
return $menu;
}
}
}
}
}
示例9: getConfigLink
/**
* {@inheritDoc}
* @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
*/
public function getConfigLink()
{
Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig';
}