本文整理汇总了PHP中create_tables函数的典型用法代码示例。如果您正苦于以下问题:PHP create_tables函数的具体用法?PHP create_tables怎么用?PHP create_tables使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_tables函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prep_DB_content
function prep_DB_content()
{
global $databaseConnection;
$admin_role_id = 1;
create_tables($databaseConnection);
create_roles($databaseConnection, $admin_role_id);
create_admin($databaseConnection, $admin_role_id);
}
示例2: installBoard
/** Installs the forum.
*
* @Given /^the forum is installed$/
*/
public function installBoard()
{
require_once __DIR__ . '/../../admin/install_common.inc.php';
create_tables($this->pdo, true);
$fp = @fopen(__DIR__ . '/../../inc/config.inc.php', 'w');
p_configuration($fp, ['database-hostname' => $this->database_hostname, 'database-username' => $this->database_username, 'database-password' => $this->database_password, 'database-name' => $this->database_name, 'table-prefix' => $this->table_prefix]);
fclose($fp);
}
示例3: prep_DB_content
function prep_DB_content()
{
global $db;
$admin_role_id = 1;
create_tables($db);
create_roles($db, $admin_role_id);
create_admin($db, $admin_role_id);
}
示例4: prep_DB_content
function prep_DB_content()
{
global $conn;
create_tables($conn);
create_user($conn);
create_user_devices($conn);
create_env($conn);
create_env_devices($conn);
}
示例5: setup_db
function setup_db()
{
global $install;
$install->title("Website Installation - Setup Database");
echo '<div class="row">';
echo '<div class="col-sm-12">';
create_tables();
create_roles();
create_admin();
install_finalise();
echo '</div>';
echo '</div>';
}
示例6: rpgsuite_install
/**
Install the Plugin
*/
function rpgsuite_install()
{
global $db;
// Create Settings
$settinggroup = array('gid' => 'NULL', 'name' => 'rpgsuite', 'title' => 'RPG Suite', 'description' => 'Settings For RPG Suite', 'disporder' => "1", 'isdefault' => "0");
$db->insert_query('settinggroups', $settinggroup);
$gid = $db->insert_id();
$settings = build_settings($gid);
foreach ($settings as $setting) {
$db->insert_query('settings', $setting);
}
rebuild_settings();
// Create the custom tables (but first ensure they aren't there already)
destroy_tables();
create_tables();
// We are going to have multiple groups, so we will split this off into another file
create_templates();
}
示例7: array
echo $lang->sprintf($lang->mybb_already_installed, $mybb->version);
$output->print_footer();
} else {
$output->steps = array('intro' => $lang->welcome, 'license' => $lang->license_agreement, 'requirements_check' => $lang->req_check, 'database_info' => $lang->db_config, 'create_tables' => $lang->table_creation, 'populate_tables' => $lang->data_insertion, 'templates' => $lang->theme_install, 'configuration' => $lang->board_config, 'adminuser' => $lang->admin_user, 'final' => $lang->finish_setup);
switch ($mybb->get_input('action')) {
case 'license':
license_agreement();
break;
case 'requirements_check':
requirements_check();
break;
case 'database_info':
database_info();
break;
case 'create_tables':
create_tables();
break;
case 'populate_tables':
populate_tables();
break;
case 'templates':
insert_templates();
break;
case 'configuration':
configure();
break;
case 'adminuser':
create_admin_user();
break;
case 'final':
install_done();
示例8: open_base
function open_base()
{
$handle = create_tables();
$handle->setAttribute(PDO::ATTR_EMULATE_PREPARES, FALSE);
return $handle;
}
示例9: dota2_install
function dota2_install()
{
include_once 'build_database.php';
create_tables();
}
示例10: compressToMonth
function compressToMonth()
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/SquidStatsMonthQueue.pid";
$pidTime = "/etc/artica-postfix/pids/SquidStatsMonthQueue.time";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
die("Already executed");
}
@file_put_contents($pidfile, getmypid());
$timeExec = $unix->file_time_min($pidTime);
if ($timeExec < 15) {
die("Only Each 15mn");
}
@unlink($pidfile);
@file_put_contents($pidfile, time());
$q = new postgres_sql();
if ($q->isRemote) {
return;
}
@file_put_contents("/etc/artica-postfix/settings/Daemons/SquidStatsMonthQueue", 0);
if (system_is_overloaded()) {
@file_put_contents("/etc/artica-postfix/settings/Daemons/SquidStatsMonthQueue", 1);
squid_admin_mysql(0, "Overloaded system {$GLOBALS["SYSTEM_INTERNAL_LOAD"]}, aborting task", null, __FILE__, __LINE__);
return;
}
$Curday = date("Y-m-d");
$sql = "SELECT date_trunc('day',zdate) as zdate FROM access_log GROUP BY date_trunc('day',zdate) ORDER BY zdate";
$q = new postgres_sql();
$q->CREATE_TABLES();
$results = $q->QUERY_SQL($sql);
if (!$q->ok) {
echo $q->mysql_error . "\n";
}
$SOURCES_DAY = array();
while ($ligne = @pg_fetch_assoc($results)) {
$day = date("Y-m-d", strtotime($ligne["zdate"]));
if ($Curday == $day) {
continue;
}
$SOURCES_DAY[$day] = true;
}
$sql = "SELECT date_trunc('day',zdate) as zdate FROM access_month GROUP BY date_trunc('day',zdate) ORDER BY zdate";
$q = new postgres_sql();
$results = $q->QUERY_SQL($sql);
if (!$q->ok) {
echo $q->mysql_error . "\n";
}
$DEST_DAY = array();
while ($ligne = @pg_fetch_assoc($results)) {
$day = date("Y-m-d", strtotime($ligne["zdate"]));
if ($Curday == $day) {
continue;
}
$DEST_DAY[$day] = true;
}
$CountOfSourcesDay = count($SOURCES_DAY);
$c = 0;
$OverLoadedCount = 0;
$OverLoadedMax = round($OverLoadedCount / 2);
while (list($Day, $ligne) = each($SOURCES_DAY)) {
if (isset($DEST_DAY[$Day])) {
echo "{$Day} already done\n";
continue;
}
echo "{$Day} not imported done\n";
$c++;
if (!compress_day($Day)) {
@file_put_contents("/etc/artica-postfix/settings/Daemons/SquidStatsMonthQueue", 1);
return;
}
if (system_is_overloaded()) {
$OverLoadedCount++;
if ($OverLoadedCount > $OverLoadedMax) {
squid_admin_mysql(0, "Overloaded system {$GLOBALS["SYSTEM_INTERNAL_LOAD"]}, aborting tasks after compressing {$c} days", null, __FILE__, __LINE__);
@file_put_contents("/etc/artica-postfix/settings/Daemons/SquidStatsMonthQueue", 1);
return;
}
}
}
if (!is_file("/etc/artica-postfix/pids/SquidStatsYearQueue.pid")) {
create_tables();
compressToYear(true);
}
}
示例11: install_base
function install_base()
{
global $phpc_config_file;
$sql_type = "mysqli";
$my_hostname = $_POST['my_hostname'];
$my_username = $_POST['my_username'];
$my_passwd = $_POST['my_passwd'];
$my_prefix = $_POST['my_prefix'];
$my_database = $_POST['my_database'];
$fp = fopen($phpc_config_file, 'w') or soft_error('Couldn\'t open config file.');
fwrite($fp, create_config($my_hostname, $my_username, $my_passwd, $my_database, $my_prefix, $sql_type)) or soft_error("Could not write to file");
fclose($fp);
// Make the database connection.
include $phpc_config_file;
$dbh = connect_db(SQL_HOST, SQL_USER, SQL_PASSWD, SQL_DATABASE);
create_tables($dbh);
$query = "REPLACE INTO `" . SQL_PREFIX . "config`\n" . "(`name`, `value`)\n" . "VALUES ('version', '" . PHPC_DB_VERSION . "')";
$dbh->query($query) or install_db_error($dbh, 'Error creating version row.', $query);
echo "<p>Config file created at \"" . realpath($phpc_config_file) . "\"</p>" . "<p>Calendars database created</p>\n" . "<div><input type=\"submit\" name=\"base\" value=\"continue\">" . "</div>\n";
}
示例12: mysql_select_db
// mysql_connect($_POST['frm_db_host'], $_POST['frm_db_user'], $_POST['frm_db_password']) or die("<FONT CLASS=\"warn\">Couldn't connect to database on '$_POST[frm_db_host]', make sure it is running and user has permissions. Click back in your browser.</FONT>");
mysql_select_db($_POST['frm_db_dbname']) or die("<FONT CLASS=\"warn\">Couldn't select database '{$_POST['frm_db_dbname']}', make sure it exists and user has permissions. Click back in your browser.</FONT>");
// $query = "SET GLOBAL sql_mode='STRICT_ALL_TABLES'"; // 11/6/08
// mysql_query($query) or die("<FONT CLASS=\"warn\">SQL error at line " . __LINE__ . " </FONT>");
}
//run the functions
switch ($_POST['frm_option']) {
case 'install':
create_tables($_POST['frm_db_prefix']);
create_user();
insert_settings();
write_conf($_POST['frm_db_host'], $_POST['frm_db_dbname'], $_POST['frm_db_user'], $_POST['frm_db_password'], $_POST['frm_db_prefix']);
print "<LI> Tickets version {$version} installation complete!";
break;
case 'install-drop':
create_tables($_POST['frm_db_prefix'], 1);
create_user();
insert_settings();
write_conf($_POST['frm_db_host'], $_POST['frm_db_dbname'], $_POST['frm_db_user'], $_POST['frm_db_password'], $_POST['frm_db_prefix']);
print "<LI> Re-Installation done!";
break;
// case 'upgrade-0.65':{
// upgrade_065_07($_POST['frm_db_prefix']);
// write_conf($_POST['frm_db_host'],$_POST['frm_db_dbname'],$_POST['frm_db_user'],$_POST['frm_db_password'],$_POST['frm_db_prefix']);
// print "<LI> Upgrade <B>0.65->0.7</B> complete!";
// break;
// }
// case 'upgrade-0.65':{
// upgrade_065_07($_POST['frm_db_prefix']);
// write_conf($_POST['frm_db_host'],$_POST['frm_db_dbname'],$_POST['frm_db_user'],$_POST['frm_db_password'],$_POST['frm_db_prefix']);
// print "<LI> Upgrade <B>0.65->0.7</B> complete!";
示例13: install_newdb
/**
* Install new DB.
*/
function install_newdb()
{
global $new_db_version, $admin_url, $baseurl, $install_login, $random_password, $create_sample_contents;
/*
* -----------------------------------------------------------------------------------
* NEW DB: Create a plain new db structure + sample contents
* -----------------------------------------------------------------------------------
*/
require_once dirname(__FILE__) . '/_functions_create.php';
if ($old_db_version = get_db_version()) {
echo '<p class="text-warning"><strong><evo:warning>' . T_('OOPS! It seems b2evolution is already installed!') . '</evo:warning></strong></p>';
if ($old_db_version < $new_db_version) {
echo '<p>' . sprintf(T_('Would you like to <a %s>upgrade your existing installation now</a>?'), 'href="?action=evoupgrade"') . '</p>';
}
return;
}
/**
* 1 - If current installation is local, test or intranet
* Used to turn off gravatar and all ping plugins
*
* @var integer
*/
$local_installation = param('local_installation', 'integer', $create_sample_contents == 'all' ? intval(check_local_installation()) : 0);
echo '<h2>' . T_('Creating b2evolution tables...') . '</h2>';
evo_flush();
create_tables();
// Update the progress bar status
update_install_progress_bar();
echo '<h2>' . T_('Creating minimum default data...') . '</h2>';
evo_flush();
create_default_data();
if ($create_sample_contents) {
global $Settings, $test_install_all_features;
echo '<h2>' . T_('Installing sample contents...') . '</h2>';
evo_flush();
// We're gonna need some environment in order to create the demo contents...
load_class('settings/model/_generalsettings.class.php', 'GeneralSettings');
load_class('users/model/_usersettings.class.php', 'UserSettings');
/**
* @var GeneralSettings
*/
$Settings = new GeneralSettings();
/**
* @var UserCache
*/
$UserCache =& get_UserCache();
// Create $current_User object.
// (Assigning by reference does not work with "global" keyword (PHP 5.2.8))
$GLOBALS['current_User'] =& $UserCache->get_by_ID(1);
create_demo_contents();
}
// Update the progress bar status
update_install_progress_bar();
track_step('install-success');
$install_result_title = T_('Installation successful!');
$install_result_body = '<p><strong>' . sprintf(T_('Now you can <a %s>log in</a> with the following credentials:'), 'href="' . $admin_url . '"') . '</strong></p>' . '<table>' . '<tr><td>' . T_('Login') . ': </td><td><strong><evo:login>' . (isset($install_login) ? $install_login : 'admin') . '</evo:login></strong></td></tr>' . '<tr><td>' . T_('Password') . ': </td><td><strong><evo:password>' . $random_password . '</evo:password></strong></td></tr>' . '</table>' . '<br /><p>' . T_('Note that password carefully! It is a <em>random</em> password that is given to you when you install b2evolution. If you lose it, you will have to delete the database tables and re-install anew.') . '</p>';
// Display installation data and instructions
echo '<h2>' . $install_result_title . '</h2>';
echo $install_result_body;
// Modal window with installation data and instructions
display_install_result_window($install_result_title, $install_result_body);
}
示例14: PDO
}
if (!isset($_SESSION['database-clear'])) {
$_SESSION['database-clear'] = false;
}
try {
$pdo = new PDO(sprintf('mysql:host=%s;dbname=%s', $_SESSION['database-hostname'], $_SESSION['database-name']), $_SESSION['database-username'], $_SESSION['database-password']);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->prefix = $_SESSION['table-prefix'];
if (isset($_POST['submit'])) {
$_SESSION['table-prefix'] = $_POST['table-prefix'];
$_SESSION['database-clear'] = isset($_POST['database-clear']) && $_POST['database-clear'] == 'true';
if (preg_match('/[^a-zA-Z1-9_]/', $_POST['table-prefix'])) {
p_errormsg(lng('error'), lng('invalidtableprefixerror'), '?step=table-create');
exit;
}
create_tables($pdo, $_SESSION['database-clear']);
header('Location: ' . $_SERVER['PHP_SELF'] . '?step=administrator-create');
exit;
}
$stmt = $pdo->prepare(<<<SQL
SELECT
TABLE_NAME
FROM
INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = :database
SQL
);
$stmt->bindValue(':database', $_SESSION['database-name']);
$stmt->execute();
$tables = $stmt->fetchAll(PDO::FETCH_COLUMN, 0);
示例15: DeltaImport
function DeltaImport($mysql_db, $date)
{
$mysql_db->query("CREATE TABLE myrulib_update(date integer primary key, aid integer, bid integer, sid integer, zid integer)");
$sqltest = "SELECT * FROM myrulib_update WHERE date=(SELECT MAX(date) FROM myrulib_update WHERE date<{$date})";
$query = $mysql_db->query($sqltest);
if ($row = $query->fetch_array()) {
$code = $row["date"];
$sqlite_db = new PDO("sqlite:./{$code}.upd");
create_tables($sqlite_db, $date);
setup_params($sqlite_db, $date, "DELTA");
convert_authors($mysql_db, $sqlite_db, $row['aid']);
convert_seqnames($mysql_db, $sqlite_db, $row['sid']);
convert_books($mysql_db, $sqlite_db, $row['bid']);
convert_sequences($mysql_db, $sqlite_db, $row['bid']);
convert_genres($mysql_db, $sqlite_db, $row['bid']);
convert_dates($mysql_db, $sqlite_db, $row['bid']);
convert_zips($mysql_db, $sqlite_db, $row['zid']);
convert_files($mysql_db, $sqlite_db, $row['zid'], $row['bid']);
system("zip {$code}.zip {$code}.upd");
}
$mysql_db->query("INSERT INTO myrulib_update(date) VALUES(" . $date . ")");
$mysql_db->query("\n\tUPDATE myrulib_update SET \n\t aid=(SELECT MAX(aid) FROM libavtorname),\n\t bid=(SELECT MAX(bid) FROM libbook),\n\t sid=(SELECT MAX(sid) FROM libseq),\n\t zid=(SELECT MAX(zid) FROM myrulib_zip)\n\tWHERE date={$date}");
}