本文整理汇总了PHP中upgrade函数的典型用法代码示例。如果您正苦于以下问题:PHP upgrade函数的具体用法?PHP upgrade怎么用?PHP upgrade使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了upgrade函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: upgrade
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER //
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, //
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE //
// SOFTWARE. //
/////////////////////////////////////////////////////////////////////////////////////
///////////////////////
// UPGRADE TO V2.0.2
///////////////////////
// ---------------------------------------------------------
// Set the proper permissions on the SQLite database file.
// Updates the version setting to 2.0.2.
// Removes and current patch version from the patch setting.
// ---------------------------------------------------------
$results = upgrade();
exit(json_encode($results));
function upgrade()
{
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "settings.class.php";
$common = new common();
$settings = new settings();
try {
// Set proper permissions on the SQLite file.
if ($settings::db_driver == "sqlite") {
chmod($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR . "portal.sqlite", 0666);
}
// Update the version and patch settings..
$common->updateSetting("version", "2.0.2");
$common->updateSetting("patch", "");
开发者ID:jprochazka,项目名称:adsb-receiver,代码行数:31,代码来源:upgrade-v2.0.2.php
示例2: DATE_FIELD
//prepare a 'goback'
// break 1; //do a re-switch
//prepare a 'goback'
// break 1; //do a re-switch
case STATE::SELECT:
$_STATE->old_date = "";
$new_date = new DATE_FIELD("txtNew", "", TRUE, TRUE, TRUE, 0, FALSE, "now");
old_date();
$_STATE->status = STATE::UPDATE;
break 2;
case STATE::UPDATE:
$_STATE->msgGreet = "";
$new_date = new DATE_FIELD("txtNew", "", TRUE, TRUE, TRUE, 0, FALSE, "now");
$msg = $new_date->audit();
if ($msg === true) {
upgrade($new_date);
} else {
$_STATE->msgStatus = $msg;
$_STATE->status = STATE::INIT;
break;
}
$_STATE->status = STATE::DONE;
break 2;
default:
throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid state=" . $_STATE->status);
}
}
//while & switch
//End Main State Gate
function old_date()
{
开发者ID:fortyspokes,项目名称:ProjectLogs,代码行数:31,代码来源:upyear_timelog.php
示例3: save
public function save($obj, $mysqli)
{
// save either one or array of objects to database
$use_existing_connection = false;
try {
// use object class name for table name
if (is_array($obj)) {
$tableName = get_class(reset($obj));
} else {
$tableName = get_class($obj);
}
if ($mysqli == null) {
// connect to database
$mysqli = mysqli_connect($settings->DatabaseServerIP, $settings->DatabaseUser, $settings->DatabasePassword, $settings->SchemaName);
} else {
$use_existing_connection = true;
}
// check to see if the table exists... if not, create.
$checkTableQuery = "SELECT COLUMN_NAME,DATA_TYPE FROM information_schema.columns WHERE table_schema = '" . $settings->SchemaName . "' AND table_name = '" . $tableName . "'";
$table = $mysqli->query($checkTableQuery);
$columns = [];
if ($table->num_rows == 0) {
// create table
$createTableQuery = "CREATE TABLE " . $tableName . " (id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY)";
$mysqli->query($createTableQuery);
$columns['id'] = 'integer';
} else {
for ($i = 0; $i < $table->num_rows; $i++) {
$data = $res->fetch_assoc();
$columns[$data['COLUMN_NAME']] = $data['DATA_TYPE'];
//TODO: add data type conversion function
}
}
// unify our process so it works with single items or arrays.
$items = [];
$ids = [];
if (is_array($obj)) {
$items = $obj;
} else {
$items[] = $obj;
}
// evaluate all items to save.
foreach ($items as $item) {
// get all item values
$properties = get_object_vars($item);
// loop through columns ($column) checking, modifying
// TODO: add data type modification function
// allowed one-way modification sequences:
// boolean > int > double > string
// date/time > string
foreach ($column as $name => $type) {
$column[$name] = php_type($type);
}
// loop through properties and add columns as needed based on type of property.
// TODO: add reverse data type conversion function
foreach ($properties as $property => $value) {
if (get_object_vars($value) == null) {
$match = false;
foreach ($column as $name => $type) {
if ($name == $property) {
$match = true;
if (gettype($value) == $type) {
} else {
$oldtype = $type;
$type = upgrade($type, gettype($value));
if ($oldtype != $type) {
$modifyColumnQuery = "ALTER TABLE " . $tablename . " MODIFY " . $property . " " . mysql_type($type) . ";";
$mysqli->query($modifyColumnQuery);
}
}
}
}
// if the column does not yet exist in the MySQL table, then add it.
if (!$match) {
$createColumnQuery = "ALTER TABLE " . $tablename . " ADD " . $property . " " . mysql_type(gettype($value)) . ";";
$mysqli->query($createColumnQuery);
}
} else {
// save the subobject in its own table.
save($value, $mysqli);
}
}
}
// catch any MySQL errors and throw them into the main error handler with appropriate context data.
if ($mysqli->error) {
throw new Exception("MySQL Error: " . $mysqli->error . " Query: " . $createTableQuery, $msqli->errno);
}
// close connection if, and only if the connection was not passed in from another function.
if (!$use_existing_connection) {
$mysqli->close();
}
} catch (Exception $e) {
error_log($e->getMessage()) . "\n";
return null;
}
// return id or list of ids. Null for exception
if (is_array($obj)) {
return $ids;
// get the whole list.
} else {
//.........这里部分代码省略.........
开发者ID:vbnet3d,项目名称:PHP-Vortex,代码行数:101,代码来源:vortex.php
示例4: Save
function Save()
{
global $page_template;
$default_pattern = "RANDOM PICKUP LINE";
$default_error_response = "No AIML category found. This is a Default Response.";
$default_conversation_lines = '1';
$default_remember_up_to = '10';
$_SESSION['errorMessage'] = '';
// First off, write the config file
$myPostVars = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
ksort($myPostVars);
$configContents = file_get_contents(_CONF_PATH_ . 'global_config.tpl');
foreach ($myPostVars as $key => $value) {
$tagSearch[] = "[{$key}]";
$varReplace[] = $value;
}
$configContents = str_replace($tagSearch, $varReplace, $configContents);
$saveFile = file_put_contents(_CONF_PATH_ . 'global_config.php', $configContents);
#die("<pre>Executing function Save - Config file saved as config.php.test\n\n</pre>\n");
// Now, update the data to the database, starting with making sure the tables are installed
$sql = "show tables;";
$conn = mysql_connect($myPostVars['dbh'], $myPostVars['dbu'], $myPostVars['dbp']) or install_error('Could not connect to the database!', mysql_error(), $sql);
$dbn = $myPostVars['dbn'];
$db = mysql_select_db($dbn, $conn) or install_error("Can't select the database {$dbn}!", mysql_error(), "use {$dbn}");
$result = mysql_query($sql, $conn) or install_error('Unknown database error!', mysql_error(), $sql);
$out = mysql_fetch_assoc($result);
if (empty($out)) {
$sql = file_get_contents('new.sql');
$queries = preg_split("/;/", $sql);
foreach ($queries as $query) {
if (strlen(trim($query)) > 0) {
$result = mysql_query($query, $conn) or install_error('Error creating new tables for DB!', mysql_error(), $sql);
$success = mysql_affected_rows();
}
}
}
$sql = 'select `error_response` from `bots` where 1 limit 1';
$result = mysql_query($sql, $conn) or upgrade($conn);
$sql = 'select `php_code` from `aiml` where 1 limit 1';
$result = mysql_query($sql, $conn) or upgrade($conn);
// $default_pattern, $default_remember_up_to, $default_conversation_lines, $default_error_response
$sql_template = "\nINSERT IGNORE INTO `bots` (`bot_id`, `bot_name`, `bot_desc`, `bot_active`, `bot_parent_id`, `format`, `use_aiml_code`, `update_aiml_code`, `save_state`, `conversation_lines`, `remember_up_to`, `debugemail`, `debugshow`, `debugmode`, `error_response`, `default_aiml_pattern`)\nVALUES ([bot_id], '[bot_name]', '[bot_desc]', '[bot_active]', '[bot_parent_id]', '[format]', '[use_aiml_code]', '[update_aiml_code]', '[save_state]', \n'{$default_conversation_lines}', '{$default_remember_up_to}', '[debugemail]', '[debugshow]', '[debugmode]', '{$default_error_response}', '{$default_pattern}');";
require_once _LIB_PATH_ . 'error_functions.php';
require_once _LIB_PATH_ . 'db_functions.php';
$bot_id = 1;
$sql = str_replace('[bot_id]', $bot_id, $sql_template);
$sql = str_replace('[bot_name]', $myPostVars["bot_name"], $sql);
$sql = str_replace('[bot_desc]', $myPostVars["bot_desc"], $sql);
$sql = str_replace('[bot_active]', $myPostVars["bot_active"], $sql);
$sql = str_replace('[bot_parent_id]', 1, $sql);
$sql = str_replace('[format]', $myPostVars["default_format"], $sql);
// "Use PHP from DB setting
if (!isset($myPostVars["default_use_aiml_code"])) {
$myPostVars["default_use_aiml_code"] = 0;
}
$sql = str_replace('[use_aiml_code]', $myPostVars["default_use_aiml_code"], $sql);
// "Update PHP in DB setting
if (!isset($myPostVars["default_update_aiml_code"])) {
$myPostVars["default_update_aiml_code"] = 0;
}
$sql = str_replace('[update_aiml_code]', $myPostVars["default_update_aiml_code"], $sql);
$sql = str_replace('[save_state]', $myPostVars["default_save_state"], $sql);
$sql = str_replace('[conversation_lines]', $default_conversation_lines, $sql);
$sql = str_replace('[remember_up_to]', $default_remember_up_to, $sql);
$sql = str_replace('[debugemail]', $myPostVars["default_debugemail"], $sql);
$sql = str_replace('[debugshow]', $myPostVars["default_debugshow"], $sql);
$sql = str_replace('[debugmode]', $myPostVars["default_debugmode"], $sql);
$sql = str_replace('[error_response]', $default_error_response, $sql);
$sql = str_replace('[default_aiml_pattern]', $default_pattern, $sql);
$save = file_put_contents(_CONF_PATH_ . 'sql.txt', $sql);
$x = db_query($sql, $conn) or install_error('Could not enter bot info for bot #' . $bot_id . '!', mysql_error(), $sql);
$encrypted_adm_dbp = md5($myPostVars["adm_dbp"]);
$adm_dbu = $myPostVars["adm_dbu"];
$cur_ip = $_SERVER['REMOTE_ADDR'];
$adminSQL = "insert ignore into `myprogramo` (`id`, `uname`, `pword`, `lastip`) values(null, '{$adm_dbu}', '{$encrypted_adm_dbp}', '{$cur_ip}');";
$result = db_query($adminSQL, $conn) or install_error('Could not add admin credentials! Check line #' . __LINE__, mysql_error(), $sql);
mysql_close($conn);
return ($result and empty($_SESSION['errorMessage'])) ? getSection('InstallComplete', $page_template) : getSection('InstallError', $page_template);
}
开发者ID:massyao,项目名称:chatbot,代码行数:79,代码来源:install_programo.php
示例5: varchar
$sql = "DROP TABLE IF EXISTS `ad_computers`;\r\n CREATE TABLE `ad_computers` (\r\n `guid` varchar(45) NOT NULL,\t# Computer object GUID from AD as a string\r\n `cn` varchar(45) NOT NULL,\t\t# Computer object CN value from AD\r\n `audit_timestamp` varchar(45) NOT NULL,\t# last audit timestamp\r\n `usnchanged` int(10) unsigned NOT NULL,\t# Computer object usnchanged value from AD\r\n `first_audit_timestamp` varchar(45) NOT NULL, # First audit timestamp\r\n `ou_id` varchar(45) NOT NULL,\t# Reference to ad_ous.ou_id (the OU that owns this computer account)\r\n `description` varchar(45) default NULL,\t# Computer object description value from AD\r\n `os` varchar(45) default NULL,\t# Computer object operatingsystem value from AD\r\n `service_pack` varchar(45) default NULL,\t# Computer object operatingsystemservicepack value from AD\r\n `dn` varchar(255) NOT NULL,\t# Computer object distinguishedname value from AD\r\n PRIMARY KEY (`guid`)\r\n ) ENGINE=MyISAM DEFAULT CHARSET=latin1;\r\n\r\n\r\n DROP TABLE IF EXISTS `ad_domains`;\r\n CREATE TABLE `ad_domains` (\r\n `guid` varchar(45) NOT NULL,\t# Unique ID for the domain (intend to use the domain AD GUID at some point)\r\n `default_nc` varchar(45) NOT NULL,\t# Domain defaultnamingcontext\r\n `fqdn` varchar(45) NOT NULL,\t# Domain FQDN\r\n `ldap_server` varchar(45) NOT NULL,\t# LDAP host server\r\n `ldap_user` varchar(45) NOT NULL,\t# LDAP login (AD Account)\r\n `ldap_password` varchar(45) NOT NULL,\t# LDAP password \r\n `netbios_name` varchar(45) NOT NULL,\t# Domain NetBIOS name\r\n PRIMARY KEY (`guid`)\r\n ) ENGINE=MyISAM DEFAULT CHARSET=latin1;\r\n\r\n\r\n DROP TABLE IF EXISTS `ad_ous`;\r\n CREATE TABLE `ad_ous` (\r\n `ou_id` varchar(45) NOT NULL,\t# Unique ID for the OU (intend to use the OU AD GUID at some point)\r\n `ou_dn` varchar(255) default NULL,\t# OU object distinguished name\r\n `ou_domain_guid` varchar(45) default NULL,\t# Reference to ad_domains.guid (the domain that owns this OU)\r\n `ou_audit_timestamp` varchar(45) default NULL,\t# Audit timestamp for this OU\r\n `include_in_audit` tinyint(1) default NULL,\t# Flag to include/exclude OU from audit\r\n PRIMARY KEY (`ou_id`)\r\n ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;\r\n\r\n\r\n DROP TABLE IF EXISTS `ad_users`;\r\n CREATE TABLE `ad_users` (\r\n `guid` varchar(45) NOT NULL,\r\n `cn` varchar(45) NOT NULL,\r\n `audit_timestamp` varchar(45) NOT NULL,\r\n `usnchanged` int(10) unsigned NOT NULL,\r\n `first_audit_timestamp` varchar(45) NOT NULL,\r\n `ou_id` varchar(45) NOT NULL,\r\n `description` varchar(45) default NULL,\r\n `department` varchar(45) default NULL,\r\n `users_dn` varchar(255) NOT NULL,\r\n PRIMARY KEY (`guid`)\r\n ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;";
upgrade($version, "08.05.21", $sql);
$sql = "ALTER TABLE `mapped` ADD COLUMN `mapped_username` varchar(100) NOT NULL default '' AFTER `mapped_size`,\r\n ADD COLUMN `mapped_connect_as` varchar(100) NOT NULL default '' AFTER `mapped_username`;\r\n\r\n ALTER TABLE `motherboard` ADD COLUMN `motherboard_cpu_sockets` INT( 10 ) NOT NULL DEFAULT '0' AFTER `motherboard_product`,\r\n ADD COLUMN `motherboard_memory_slots` INT( 10 ) NOT NULL DEFAULT '0' AFTER `motherboard_cpu_sockets`;\r\n\r\n ALTER TABLE `groups` CHANGE `groups_members` `groups_members` VARCHAR( 255 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;";
upgrade($version, "08.06.06", $sql);
$sql = "ALTER TABLE `memory` ADD COLUMN `memory_tag` varchar(255) NOT NULL default '' AFTER `memory_speed`";
upgrade($version, "08.07.23", $sql);
$sql = "DROP TABLE IF EXISTS `ad_computers`;\r\n DROP TABLE IF EXISTS `ad_domains`;\r\n DROP TABLE IF EXISTS `ad_ous`;\r\n DROP TABLE IF EXISTS `ad_users`;\r\n\r\n DROP TABLE IF EXISTS `ldap_computers`;\r\n CREATE TABLE `ldap_computers` (\r\n `ldap_computers_guid` varchar(45) NOT NULL,\r\n `ldap_computers_cn` varchar(255) NOT NULL,\r\n `ldap_computers_timestamp` varchar(45) NOT NULL,\r\n `ldap_computers_first_timestamp` varchar(45) NOT NULL,\r\n `ldap_computers_path_id` varchar(45) NOT NULL,\r\n `ldap_computers_description` varchar(255) default NULL,\r\n `ldap_computers_os` varchar(255) default NULL,\r\n `ldap_computers_service_pack` varchar(255) default NULL,\r\n `ldap_computers_dn` varchar(255) NOT NULL,\r\n PRIMARY KEY (`ldap_computers_guid`)\r\n ) ENGINE=MyISAM DEFAULT CHARSET=latin1;\r\n\r\n DROP TABLE IF EXISTS `ldap_connections`;\r\n CREATE TABLE `ldap_connections` (\r\n `ldap_connections_id` int(10) unsigned NOT NULL auto_increment,\r\n `ldap_connections_nc` varchar(255) NOT NULL,\r\n `ldap_connections_fqdn` varchar(255) NOT NULL,\r\n `ldap_connections_server` varchar(255) NOT NULL,\r\n `ldap_connections_user` varchar(45) NOT NULL,\r\n `ldap_connections_password` varchar(45) NOT NULL,\r\n `ldap_connections_name` varchar(45) NOT NULL,\r\n `ldap_connections_schema` varchar(45) NOT NULL,\r\n PRIMARY KEY (`ldap_connections_id`)\r\n ) ENGINE=MyISAM DEFAULT CHARSET=latin1;\r\n\r\n DROP TABLE IF EXISTS `ldap_paths`;\r\n CREATE TABLE `ldap_paths` (\r\n `ldap_paths_id` int(10) unsigned NOT NULL auto_increment,\r\n `ldap_paths_dn` varchar(255) default NULL,\r\n `ldap_paths_connection_id` varchar(45) default NULL,\r\n `ldap_paths_timestamp` varchar(45) default NULL,\r\n `ldap_paths_audit` tinyint(1) default NULL,\r\n PRIMARY KEY (`ldap_paths_id`)\r\n ) ENGINE=MyISAM DEFAULT CHARSET=latin1;\r\n\r\n DROP TABLE IF EXISTS `ldap_users`;\r\n CREATE TABLE `ldap_users` (\r\n `ldap_users_guid` varchar(45) NOT NULL,\r\n `ldap_users_cn` varchar(255) NOT NULL,\r\n `ldap_users_timestamp` varchar(45) NOT NULL,\r\n `ldap_users_first_timestamp` varchar(45) NOT NULL,\r\n `ldap_users_path_id` varchar(45) NOT NULL,\r\n `ldap_users_description` varchar(255) default NULL,\r\n `ldap_users_department` varchar(255) default NULL,\r\n `ldap_users_dn` varchar(255) NOT NULL,\r\n PRIMARY KEY (`ldap_users_guid`)\r\n ) ENGINE=MyISAM DEFAULT CHARSET=latin1;\r\n\r\n DROP TABLE IF EXISTS `log`;\r\n CREATE TABLE `log` (\r\n `log_id` int(10) unsigned NOT NULL auto_increment,\r\n `log_timestamp` varchar(45) NOT NULL,\r\n `log_message` varchar(1024) NOT NULL,\r\n `log_severity` int(10) unsigned NOT NULL,\r\n `log_module` varchar(128) NOT NULL,\r\n `log_function` varchar(128) NOT NULL,\r\n PRIMARY KEY (`log_id`)\r\n ) ENGINE=MyISAM DEFAULT CHARSET=latin1;";
upgrade($version, "08.10.08", $sql);
// Add indexes to improve performance of queries used by index.php - this can take longer than standard script timeout
set_time_limit(300);
$sql = "ALTER TABLE `software` ADD INDEX `Index3`(`software_first_timestamp`);\r\n ALTER TABLE `software` ADD INDEX `Index4`(`software_name`);\r\n ALTER TABLE `system` ADD INDEX `Index3`(`system_first_timestamp`);";
upgrade($version, "08.10.09", $sql);
//Added more ldap fields (most of the active directory ;¬)
set_time_limit(3000);
$sql = "ALTER TABLE `ldap_users` ADD COLUMN `ldap_users_sn` varchar(255) NOT NULL default '' AFTER `ldap_users_dn`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_c` varchar(255) NOT NULL default '' AFTER `ldap_users_sn`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_l` varchar(255) NOT NULL default '' AFTER `ldap_users_c`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_st` varchar(255) NOT NULL default '' AFTER `ldap_users_l`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_title` varchar(255) NOT NULL default '' AFTER `ldap_users_st`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_postalcode` varchar(255) NOT NULL default '' AFTER `ldap_users_title`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_physicaldeliveryofficename` varchar(255) NOT NULL default '' AFTER `ldap_users_postalcode`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_telephonenumber` varchar(255) NOT NULL default '' AFTER `ldap_users_physicaldeliveryofficename`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_givenname` varchar(255) NOT NULL default '' AFTER `ldap_users_telephonenumber`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_distinguishedname` varchar(255) NOT NULL default '' AFTER `ldap_users_givenname`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_instancetype` varchar(255) NOT NULL default '' AFTER `ldap_users_distinguishedname`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_whencreated` varchar(255) NOT NULL default '' AFTER `ldap_users_instancetype`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_whenchanged` varchar(255) NOT NULL default '' AFTER `ldap_users_whencreated`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_displayname` varchar(255) NOT NULL default '' AFTER `ldap_users_whenchanged`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_usncreated` varchar(255) NOT NULL default '' AFTER `ldap_users_displayname`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_usnchanged` varchar(255) NOT NULL default '' AFTER `ldap_users_usncreated`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_co` varchar(255) NOT NULL default '' AFTER `ldap_users_usnchanged`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_company` varchar(255) NOT NULL default '' AFTER `ldap_users_co`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_streetaddress` varchar(255) NOT NULL default '' AFTER `ldap_users_company`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_name` varchar(255) NOT NULL default '' AFTER `ldap_users_streetaddress`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_objectguid` varchar(255) NOT NULL default '' AFTER `ldap_users_name`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_useraccountcontrol` varchar(255) NOT NULL default '' AFTER `ldap_users_objectguid`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_badpwdcount` varchar(255) NOT NULL default '' AFTER `ldap_users_useraccountcontrol`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_codepage` varchar(255) NOT NULL default '' AFTER `ldap_users_badpwdcount`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_countrycode` varchar(255) NOT NULL default '' AFTER `ldap_users_codepage`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_badpasswordtime` varchar(255) NOT NULL default '' AFTER `ldap_users_countrycode`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_lastlogoff` varchar(255) NOT NULL default '' AFTER `ldap_users_badpasswordtime`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_lastlogon` varchar(255) NOT NULL default '' AFTER `ldap_users_lastlogoff`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_scriptpath` varchar(255) NOT NULL default '' AFTER `ldap_users_lastlogon`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_pwdlastset` varchar(255) NOT NULL default '' AFTER `ldap_users_scriptpath`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_primarygroupid` varchar(255) NOT NULL default '' AFTER `ldap_users_pwdlastset`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_objectsid` varchar(255) NOT NULL default '' AFTER `ldap_users_primarygroupid`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_accountexpires` varchar(255) NOT NULL default '' AFTER `ldap_users_objectsid`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_logoncount` varchar(255) NOT NULL default '' AFTER `ldap_users_accountexpires`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_samaccountname` varchar(255) NOT NULL default '' AFTER `ldap_users_logoncount`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_samaccounttype` varchar(255) NOT NULL default '' AFTER `ldap_users_samaccountname`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_userprincipalname` varchar(255) NOT NULL default '' AFTER `ldap_users_samaccounttype`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_lockouttime` varchar(255) NOT NULL default '' AFTER `ldap_users_userprincipalname`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_objectcategory` varchar(255) NOT NULL default '' AFTER `ldap_users_lockouttime`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_dscorepropagationdata` varchar(255) NOT NULL default '' AFTER `ldap_users_objectcategory`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_lastlogontimestamp` varchar(255) NOT NULL default '' AFTER `ldap_users_dscorepropagationdata`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_mail` varchar(255) NOT NULL default '' AFTER `ldap_users_lastlogontimestamp`;\r\nALTER TABLE `ldap_users` ADD COLUMN `ldap_users_manager` varchar(255) NOT NULL default '' AFTER `ldap_users_mail`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_distinguishedname` varchar(255) NOT NULL default '' AFTER `ldap_computers_cn`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_instancetype` varchar(255) NOT NULL default '' AFTER `ldap_computers_distinguishedname`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_whencreated` varchar(255) NOT NULL default '' AFTER `ldap_computers_instancetype`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_whenchanged` varchar(255) NOT NULL default '' AFTER `ldap_computers_whencreated`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_displayname` varchar(255) NOT NULL default '' AFTER `ldap_computers_whenchanged`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_usncreated` varchar(255) NOT NULL default '' AFTER `ldap_computers_displayname`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_usnchanged` varchar(255) NOT NULL default '' AFTER `ldap_computers_usncreated`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_name` varchar(255) NOT NULL default '' AFTER `ldap_computers_usnchanged`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_objectguid` varchar(255) NOT NULL default '' AFTER `ldap_computers_name`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_useraccountcontrol` varchar(255) NOT NULL default '' AFTER `ldap_computers_objectguid`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_badpwdcount` varchar(255) NOT NULL default '' AFTER `ldap_computers_useraccountcontrol`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_codepage` varchar(255) NOT NULL default '' AFTER `ldap_computers_badpwdcount`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_countrycode` varchar(255) NOT NULL default '' AFTER `ldap_computers_codepage`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_badpasswordtime` varchar(255) NOT NULL default '' AFTER `ldap_computers_countrycode`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_lastlogoff` varchar(255) NOT NULL default '' AFTER `ldap_computers_badpasswordtime`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_lastlogon` varchar(255) NOT NULL default '' AFTER `ldap_computers_lastlogoff`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_localpolicyflags` varchar(255) NOT NULL default '' AFTER `ldap_computers_lastlogon`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_pwdlastset` varchar(255) NOT NULL default '' AFTER `ldap_computers_localpolicyflags`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_primarygroupid` varchar(255) NOT NULL default '' AFTER `ldap_computers_pwdlastset`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_objectsid` varchar(255) NOT NULL default '' AFTER `ldap_computers_primarygroupid`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_accountexpires` varchar(255) NOT NULL default '' AFTER `ldap_computers_objectsid`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_logoncount` varchar(255) NOT NULL default '' AFTER `ldap_computers_accountexpires`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_samaccountname` varchar(255) NOT NULL default '' AFTER `ldap_computers_logoncount`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_samaccounttype` varchar(255) NOT NULL default '' AFTER `ldap_computers_samaccountname`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_operatingsystem` varchar(255) NOT NULL default '' AFTER `ldap_computers_samaccounttype`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_operatingsystemversion` varchar(255) NOT NULL default '' AFTER `ldap_computers_operatingsystem`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_operatingsystemservicepack` varchar(255) NOT NULL default '' AFTER `ldap_computers_operatingsystemversion`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_dnshostname` varchar(255) NOT NULL default '' AFTER `ldap_computers_operatingsystemservicepack`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_serviceprincipalname` varchar(255) NOT NULL default '' AFTER `ldap_computers_dnshostname`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_objectcategory` varchar(255) NOT NULL default '' AFTER `ldap_computers_serviceprincipalname`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_iscriticalsystemobject` varchar(255) NOT NULL default '' AFTER `ldap_computers_objectcategory`;\r\nALTER TABLE `ldap_computers` ADD COLUMN `ldap_computers_lastlogontimestamp` varchar(255) NOT NULL default '' AFTER `ldap_computers_iscriticalsystemobject`;";
upgrade($version, "08.12.10", $sql);
// ************* Version 09.03.17 *******************************************************************
// Update include_config.php - preserving existing values
$current_content = file_get_contents("include_config.php");
$content = "<?php\ninclude_once \"include_config_defaults.php\"; // Ensures that all variables have a default value\n";
$content .= substr($current_content, 6);
if (is_writable("include_config.php")) {
if (!($handle = fopen("include_config.php", 'w'))) {
exit("Cannot open file ({$filename})");
}
if (fwrite($handle, $content) === FALSE) {
exit("Cannot write to file ({$filename})");
}
echo __("The Open-AudIT config has been updated");
fclose($handle);
} else {
开发者ID:kumarsivarajan,项目名称:ctrl-dock,代码行数:31,代码来源:upgrade.php
示例6: init_module
/**
* Install, uninstall, or upgrade a module. This calls the init file in a module and runs one of the following functions:
* install(), uninstall(), or upgrade().
*
* @param int $id
* @param string $action
*
*/
function init_module($id, $action, $msg = '')
{
$directory = $this->get_module($id);
if (!$directory) {
return false;
}
if ($this->exists($directory['directory'], '/init.php')) {
require_once $this->modules_dir . '/' . $directory['directory'] . '/init.php';
}
if ($action == "deactivate") {
if (function_exists('uninstall')) {
$msg = uninstall();
}
$this->db->delete('modules', array('id' => $id));
return $msg;
} elseif ($action == "upgrade") {
if (function_exists('upgrade')) {
upgrade();
}
if ($this->exists($directory['directory'])) {
$data = $this->get_config($directory['directory']);
$module_data = array('name' => $data['module']['name'], 'displayname' => $data['module']['displayname'], 'description' => $data['module']['description'], 'directory' => $data['module']['name'], 'version' => $data['module']['version'], 'active' => 1);
$this->db->where('id', $id);
$this->db->update('modules', $module_data);
$this->db->cache_delete_all();
}
} else {
if (function_exists('install')) {
install();
}
}
}
开发者ID:Bobberty,项目名称:68KB,代码行数:40,代码来源:modules_model.php
示例7: install
function install()
{
global $dblink, $dbserv, $dbuser, $dbpass, $dbname, $dbpref, $dberror, $abxd_version;
doSanityChecks();
if (file_exists("config/database.php")) {
//TODO: Check for errors when parsing this file (It may be corrupted or wrong or whatever.
//If it fails, fail gracefully and instruct the user to fix or delete database.php
include "config/database.php";
} else {
$dbserv = $_POST['dbserv'];
$dbuser = $_POST['dbuser'];
$dbpass = $_POST['dbpass'];
$dbname = $_POST['dbname'];
$dbpref = $_POST['dbpref'];
}
$convert = $_POST["convert"] == "true";
$convertFrom = $_POST["convertFrom"];
$convertDbName = $_POST["convertDbName"];
$convertDbPrefix = $_POST["convertDbPrefix"];
if (!sqlConnect()) {
installationError("Could not connect to the database. Error was: " . $dberror);
}
$currVersion = getInstalledVersion();
if ($currVersion == $abxd_version) {
installationError("The board is already installed and updated (Database version {$currVersion}). You don't need to run the installer!\n");
}
if ($currVersion != -1 && $convert) {
die("ERROR: You asked to convert a forum database, but an ABXD installation was already found in the installation DB. Converting is only possible when doing a new installation.");
}
echo "Setting utf8_unicode_ci collation to the database...\n";
query("ALTER DATABASE {$dbname} COLLATE utf8_unicode_ci");
if ($currVersion == -1) {
echo "Installing database version {$abxd_version}...\n";
} else {
echo "Upgrading database from version {$currVersion} to {$abxd_version}...\n";
}
upgrade();
$misc = Query("select * from {misc}");
if (NumRows($misc) == 0) {
Query("INSERT INTO `{misc}` (`views`, `hotcount`, `milestone`, `maxuserstext`) VALUES (0, 30, 'Nothing yet.', 'Nobody yet.');");
}
Query("UPDATE `{misc}` SET `version` = {0}", $abxd_version);
if (!is_dir("config")) {
mkdir("config");
}
if ($currVersion == -1) {
//Stuff to do on new installation (Not upgrade)
Import("install/smilies.sql");
if ($convert) {
runConverter($convertFrom, $convertDbName, $convertPrefix);
} else {
Import("install/installDefaults.sql");
}
if (file_exists("config/salt.php")) {
echo "Not generating new salt.php as it's already present...\n";
} else {
echo "Generating new salt.php...\n";
writeConfigSalt();
}
}
if (!file_exists("config/database.php")) {
writeConfigDatabase();
}
}
开发者ID:knytrune,项目名称:ABXD,代码行数:64,代码来源:installer.php
示例8: stats_derive
// add derived stats
$stats = stats_derive($stats);
// modify derived stats by talents
$stats = talents_calculate_derived($stats);
// modify derived stats by buffs
$stats = buffs_calculate_derived($stats);
// dps is only counted when comparing weapons, dont add it to total score yet.
$stats["dps"][0]="0";
// fetch items and show upgrade suggestion list
$slot = $_GET['slot'];
$slotgeneral = trim($slot, "0..9"); // remove the number (ring1 -> ring, lesser3 -> lesser, etc)
upgrade($slotgeneral,$_POST[$slot.'suggest'],$stats,$statslist,$mainhand,$offhand,$spec);
mysql_close($link);
// END OF MAIN CODE //
// this function returns a html table with all alternative items for the given slot, and score relative to the given itemname
function upgrade($slot,$currentitemname,$stats,$statslist,$mainhand,$offhand,$spec)
{
// if no name was entered, assume "None (Slot)" was intended
if($currentitemname=="") $currentitemname = "None (".$slot.")";
// create array with old values of stats
$oldstats = array();
foreach($stats as $stat) {
$oldstats[$stat[1]] = $stats[$stat[1]][0];
}
开发者ID:Roobarb,项目名称:Rift-Upgrades,代码行数:31,代码来源:calculate.php
示例9: dirname
}
include_once dirname(__FILE__) . '/ressources/class.templates.inc';
include_once dirname(__FILE__) . '/ressources/class.status.inc';
include_once dirname(__FILE__) . '/ressources/class.os.system.inc';
include_once dirname(__FILE__) . '/framework/class.unix.inc';
include_once dirname(__FILE__) . "/framework/frame.class.inc";
if (preg_match("#--verbose#", implode(" ", $argv))) {
$GLOBALS["debug"] = true;
$GLOBALS["VERBOSE"] = true;
}
if ($argv[1] == "--detect") {
detect_kernels();
die;
}
if ($argv[1] == "--install") {
upgrade($argv[2]);
die;
}
function detect_kernels()
{
$unix = new unix();
if (!$GLOBALS["VERBOSE"]) {
if (is_file("/usr/share/artica-postfix/ressources/logs/kernel.lst")) {
if ($unix->file_time_min("/usr/share/artica-postfix/ressources/logs/kernel.lst") < 360) {
die;
}
}
}
$users = new usersMenus();
if ($users->LinuxDistriCode != "DEBIAN" && $users->LinuxDistriCode != "UBUNTU") {
die;
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:exec.apt-cache.kernel.php
示例10: activate
/**
* Runs on activation
*
* Currently:
* - Calls `init`
* - Calls `upgrade`
* - Flushes the rewrite rules so this plugin's PT permalinks
* are registered with WP
*
* @since 3.0.0
*/
function activate()
{
init();
upgrade();
flush_rewrite_rules();
php_version_check();
}
开发者ID:evgalak,项目名称:woocommerce-product-faqs,代码行数:18,代码来源:shared.php
示例11: upgrade
$version = $database->loadResult();
// If current version is 2.00
if (in_array($version, array('2.00', '-1', '2.0.0', ''))) {
upgrade(2, 0, 0);
}
$database->setQuery('SELECT value, varname FROM #__mt_config WHERE varname LIKE \'%version\' AND groupname = \'core\' LIMIT 4');
$version = $database->loadObjectList('varname');
// A fix for 2.0.1/3/4. Appears that 2.0.1/3/4's mtree.xml file does not update dev_version to 1/3/4
if (in_array($version['version']->value, array('2.0.1', '2.0.3', '2.0.4'))) {
$version['major_version']->value = 2;
$version['minor_version']->value = 0;
$version['dev_version']->value = substr($version['version']->value, -1, 1);
}
JToolBarHelper::title(JText::_('Mosets Tree Upgrader'));
printStartTable();
if (upgrade($version['major_version']->value, $version['minor_version']->value, $version['dev_version']->value) === false) {
// printRow('You\'re currently at version ' . $version['major_version']->value . '.' . $version['minor_version']->value . '.' . $version['dev_version']->value);
// printRow('No more upgrades needed.',2);
} else {
printRow('Upgrades Completed!', 2);
printRow('<a href="index2.php?option=com_mtree">< Back to Mosets Tree</a>', 2);
}
printEndTable();
function is15xSeries()
{
global $mainframe;
$database =& JFactory::getDBO();
$db_prefix = $mainframe->getCfg('dbprefix');
$database->setQuery("SHOW TABLE STATUS LIKE '" . $db_prefix . "mt_config'");
$table = $database->loadObject();
if ($table->Name == $db_prefix . 'mt_config' && $table->Rows == 30) {
开发者ID:rsemedo,项目名称:Apply-Within,代码行数:31,代码来源:upgrade.php
示例12: loadSQLFile
function loadSQLFile($db, $filename)
{
$lines = explode("\n", file_get_contents($filename));
foreach ($lines as $line) {
upgrade($db, $line);
}
}
开发者ID:jibinam,项目名称:budabot2,代码行数:7,代码来源:upgrade.php
示例13: saveconfig
saveconfig($cid[0], $option);
break;
case 'uploadfile':
uploadPackage();
break;
case 'uploadlanguage':
uploadPackage();
break;
case 'changelanguage':
changeLanguage();
break;
case 'import_swMenuFree':
import_swmenufree();
break;
case "upgrade":
upgrade($option);
break;
case "exportMenu":
$msg = exportMenu($cid[0], $option);
$mainframe->redirect("index2.php?task=showmodules&option={$option}&limit={$limit}&limitstart={$limitstart}", $msg);
break;
case "imagesave":
saveImages($cid[0], $option);
break;
case "manualsave":
saveCSS($cid[0], $option);
break;
case "editDhtmlMenu":
editDhtmlMenu($cid[0], $option);
break;
case "editCSS":
开发者ID:vnishukov,项目名称:agere,代码行数:31,代码来源:admin.swmenupro.php
示例14: header
header('Content-type:application/text');
header('Content-Disposition:attachment;filename=bugfree.sql.gz');
echo $compressSql;
break;
}
}
renderFile($viewFile, array('version' => $version));
@mysql_close($con);
break;
case UPGRADE:
list($dbhost, $dbname, $port, $dbuser, $dbpwd, $dbprefix) = getDBConfig(CONFIG_FILE);
list($result, $info, $target, $con) = getDBCon($dbhost, $port, $dbuser, $dbpwd);
if (!$result) {
$dbVersion = isset($_GET['dbversion']) ? $_GET['dbversion'] : null;
$step = isset($_GET['step']) ? $_GET['step'] : 1;
list($result, $info, $dbVersion, $step) = upgrade($con, $dbname, $dbprefix, $dbVersion, $step);
}
@mysql_close($con);
echo json_encode(array('result' => $result, 'info' => $info, 'dbversion' => $dbVersion, 'step' => $step));
break;
case UPGRADED:
$viewFile = $viewDir . 'upgraded.php';
file_put_contents('install.lock', '');
renderFile($viewFile);
break;
case CONFIG:
$viewFile = $viewDir . 'config.php';
renderFile($viewFile);
break;
case INSTALL:
$dbname = isset($_POST['dbname']) ? $_POST['dbname'] : '';
开发者ID:mjrao,项目名称:BugFree,代码行数:31,代码来源:index.php
示例15: uploadPackage
function uploadPackage()
{
$absolute_path = JPATH_ROOT;
//echo $absolute_path;
$userfile = JRequest::getVar(
|
请发表评论