本文整理汇总了PHP中serendipity_db_schema_import函数的典型用法代码示例。如果您正苦于以下问题:PHP serendipity_db_schema_import函数的具体用法?PHP serendipity_db_schema_import怎么用?PHP serendipity_db_schema_import使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了serendipity_db_schema_import函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupDB
function setupDB()
{
global $serendipity;
if (serendipity_db_bool($this->get_config('db_built', false))) {
return true;
}
#FIXME: Add hooks for XML / exporting to convert images/text to ascii art/text or text-only.
# That doesn't belong here.
$sql = "CREATE TABLE {$serendipity['dbPrefix']}mymood (\n mood_id {AUTOINCREMENT} {PRIMARY},\n mood_name varchar(255) NOT NULL default '',\n mood_img varchar(255) NOT NULL default '',\n mood_ascii varchar(255) NOT NULL default ''\n )";
serendipity_db_schema_import($sql);
# Setting up some basic moods...
$moods = array();
$default_moods = explode('|`|', PLUGIN_MYMOOD_LISTOFMOODS);
foreach ($default_moods as $mood_s) {
$info_array = explode('|~|', $mood_s);
$moods[] = array('mood_name' => $info_array[0], 'mood_img' => $info_array[1], 'mood_ascii' => $info_array[2]);
}
#gar! hafta check if there's already one defined...stupid 5000 'Happy's in my db...
#fixme: this may need some sort of case insensitive stuff...
# also will want to add that to the adding part..
foreach ($moods as $mood_array) {
$check_q = "SELECT mood_id FROM {$serendipity['dbPrefix']}mymood WHERE mood_name='{$mood_array['mood_name']}'";
$t = serendipity_db_query($check_q);
if (!empty($t[0])) {
continue;
}
$insert_q = "INSERT INTO {$serendipity['dbPrefix']}mymood\n (mood_name, mood_img, mood_ascii)\n VALUES (\n '{$mood_array['mood_name']}', '{$mood_array['mood_img']}','{$mood_array['mood_ascii']}')";
serendipity_db_query($insert_q);
}
$this->set_config('db_built', 'true');
}
示例2: check_lj_entries
function check_lj_entries()
{
global $serendipity;
if (!is_array(serendipity_db_query("SELECT id FROM {$serendipity['dbPrefix']}lj_entries LIMIT 1", true, 'both', false, false, false, true))) {
serendipity_db_schema_import("CREATE TABLE {$serendipity['dbPrefix']}lj_entries (\n entry_id int default null,\n itemid int default null,\n current_mood varchar(255) default null,\n current_music varchar(255) default null,\n picture_keyword varchar(255) default null,\n security varchar(255) default null,\n opt_nocomments varchar(255) default null\n );");
}
}
示例3: setupDB
function setupDB()
{
global $serendipity;
if (serendipity_db_bool($this->get_config('db_built4', false))) {
return true;
}
if (serendipity_db_bool($this->get_config('db_built3', false))) {
$sql = "UPDATE {$serendipity['dbPrefix']}mycalendar SET eventdate2 = eventdate WHERE (eventdate2 = 0) OR eventdate2 IS NULL;";
serendipity_db_schema_import($sql);
$this->set_config('db_built4', 'true');
return true;
}
if (serendipity_db_bool($this->get_config('db_built2', false))) {
$sql = "ALTER TABLE {$serendipity['dbPrefix']}mycalendar ADD eventdate2 int(10) {UNSIGNED} default null;";
serendipity_db_schema_import($sql);
$this->set_config('db_built3', 'true');
return true;
}
if (serendipity_db_bool($this->get_config('db_built', false))) {
$sql = "ALTER TABLE {$serendipity['dbPrefix']}mycalendar ADD eventurltitle varchar(255) default null;";
serendipity_db_schema_import($sql);
$this->set_config('db_built2', 'true');
return true;
}
$sql = "CREATE TABLE {$serendipity['dbPrefix']}mycalendar (\n eventid {AUTOINCREMENT} {PRIMARY},\n eventname varchar(255) NOT NULL default '',\n eventurl varchar(255) NOT NULL default '',\n eventurltitle varchar(255) NOT NULL default '',\n eventdate int(10) {UNSIGNED} default null,\n eventdate2 int(10) {UNSIGNED} default null,\n eventcategory varchar(255) NOT NULL default '',\n eventtype varchar(255) NOT NULL default ''\n );";
serendipity_db_schema_import($sql);
$this->set_config('db_built4', 'true');
}
示例4: install
function install()
{
global $serendipity;
if (!$this->tableCreated('facebook')) {
$q = "CREATE TABLE {$serendipity['dbPrefix']}facebook (\n entryid int(10) not null,\n base_url varchar(255),\n resolved_url varchar(255)\n )";
$result = serendipity_db_schema_import($q);
serendipity_db_schema_import("CREATE INDEX fbindex ON {$serendipity['dbPrefix']}facebook (base_url)");
}
}
示例5: setupDB
function setupDB()
{
global $serendipity;
$built = $this->get_config('db_built', null);
if (empty($built)) {
serendipity_db_schema_import("CREATE TABLE {$serendipity['dbPrefix']}dejure (\n ckey varchar(32),\n cache text,\n last_update int(10) {UNSIGNED}\n )");
serendipity_db_schema_import('CREATE UNIQUE INDEX dejure_cacheidx ON {PREFIX}dejure (ckey)');
}
}
示例6: setupDB
function setupDB()
{
global $serendipity;
$built = $this->get_config('db_built', null);
if (empty($built)) {
$q = "@CREATE {FULLTEXT_MYSQL} INDEX commentbody_idx on {$serendipity['dbPrefix']}comments (title, body);";
serendipity_db_schema_import($q);
$this->set_config('db_built', 1);
}
}
示例7: setupDB
function setupDB()
{
global $serendipity;
$built = $this->get_config('db_built', null);
$fresh = false;
if (empty($built) && !defined('VERSIONING_UPGRADE_DONE')) {
serendipity_db_schema_import("CREATE TABLE {$serendipity['dbPrefix']}versioning (\r\n id {AUTOINCREMENT} {PRIMARY},\r\n entry_id int(11) default '0',\r\n version int(4) default '1',\r\n body text,\r\n extended text,\r\n version_date int(11) default '0',\r\n version_author int(4) default '0'\r\n )");
$this->set_config('db_built', '1');
@define('VERSIONING_UPGRADE_DONE', true);
}
}
示例8: setupDB
function setupDB()
{
global $serendipity;
if (serendipity_db_bool($this->get_config('db_built_1', false))) {
return true;
}
$sql = "CREATE TABLE {$serendipity['dbPrefix']}adminnotes (\n noteid {AUTOINCREMENT} {PRIMARY},\n authorid int(10) {UNSIGNED} default null,\n notetime int(10) {UNSIGNED} default null,\n subject varchar(255),\n body text,\n notetype varchar(255) NOT NULL default ''\n );";
serendipity_db_schema_import($sql);
$sql = "CREATE TABLE {$serendipity['dbPrefix']}adminnotes_to_groups (\n noteid int(10) {UNSIGNED} default null,\n groupid int(10) {UNSIGNED} default null\n );";
serendipity_db_schema_import($sql);
$this->set_config('db_built_1', 'true');
}
示例9: checkScheme
function checkScheme()
{
global $serendipity;
$version = $this->get_config('version', 'none');
if ($version == 'none') {
$q = "CREATE TABLE {$serendipity['dbPrefix']}markread (\n entryid int(11) default null,\n visitor varchar(64) default null,\n read_date int(10) {UNSIGNED} NULL\n )";
$sql = serendipity_db_schema_import($q);
$q = "CREATE INDEX readfetch ON {$serendipity['dbPrefix']}markread (entryid, visitor);";
$sql = serendipity_db_schema_import($q);
$this->set_config('version', '1.0');
}
return true;
}
示例10: install
static function install(&$obj)
{
global $serendipity;
if (!OEmbedDatabase::table_created(PLUGIN_OEMBED_DATABASEVNAME)) {
$md5test = md5("test");
$md5len = strlen($md5test);
$q = "create table {$serendipity['dbPrefix']}" . PLUGIN_OEMBED_DATABASEVNAME . " (" . "urlmd5 char({$md5len}) not null, " . "url varchar(3000) not null, " . "oetype varchar(20) not null, " . "oeobj text not null, " . "primary key (urlmd5)" . ")";
$result = serendipity_db_schema_import($q);
if ($result !== true) {
return;
}
}
}
示例11: setupDB
function setupDB()
{
global $serendipity;
$built = $this->get_config('db_built', null);
if (empty($built) && !defined('PLUGIN_POLL_UPGRADE_DONE')) {
serendipity_db_schema_import("CREATE TABLE {$serendipity['dbPrefix']}polls (\n id {AUTOINCREMENT} {PRIMARY},\n title varchar(255) not null default '',\n content text,\n active int(1) default '1',\n votes int(4) default '0',\n timestamp int(10) {UNSIGNED} default null);");
serendipity_db_schema_import("CREATE TABLE {$serendipity['dbPrefix']}polls_options (\n id {AUTOINCREMENT} {PRIMARY},\n pollid int(10) {UNSIGNED},\n title varchar(255) not null default '',\n votes int(4) default '0',\n timestamp int(10) {UNSIGNED} default null);");
serendipity_db_schema_import("CREATE INDEX pollidx ON {PREFIX}polls_options (pollid);");
$this->set_config('db_built', '1');
@define('PLUGIN_POLL_UPGRADE_DONE', true);
// No further static pages may be called!
}
}
示例12: setupDB
function setupDB()
{
global $serendipity;
if (serendipity_db_bool($this->get_config('db_built_1', false))) {
return true;
}
if (preg_match('@mysql@i', $serendipity['dbType'])) {
$sql = "CREATE TABLE {$serendipity['dbPrefix']}linktrimmer (\n id {AUTOINCREMENT} {PRIMARY},\n hash varchar(32) collate latin1_general_cs,\n url text\n );";
} else {
$sql = "CREATE TABLE {$serendipity['dbPrefix']}linktrimmer (\n id {AUTOINCREMENT} {PRIMARY},\n hash varchar(32),\n url text\n );";
}
serendipity_db_schema_import($sql);
$sql = "CREATE INDEX linkidx ON {$serendipity['dbPrefix']}linktrimmer (hash)";
serendipity_db_schema_import($sql);
$this->set_config('db_built_1', 'true');
}
示例13: setupDB
function setupDB()
{
global $serendipity;
$q = "CREATE TABLE {$serendipity['dbPrefix']}dma_sqlbackup (\n\t\t\t\t\tauto_backup \tint(2)\t\tNOT NULL \tdefault '0',\n\t\t\t\t\ttime_backup \tint(10)\t\tNOT NULL \tdefault '0',\n\t\t\t\t\tlast_backup \tint(10) \tNOT NULL \tdefault '0',\n\t\t\t\t\tdata_backup \ttext \t\tNOT NULL,\n\t\t\t\t\tauto_backdel \tint(2) \t\tNOT NULL \tdefault '0',\n\t\t\t\t\ttime_backdel \tint(10) \tNOT NULL \tdefault '0',\n\t\t\t\t\tlast_backdel \tint(10) \tNOT NULL \tdefault '0'\n\t\t\t)";
$sql = serendipity_db_schema_import($q);
$q = "CREATE TABLE {$serendipity['dbPrefix']}dma_htmlbackup (\n\t\t\t\t\tauto_backup \tint(2)\t\tNOT NULL \tdefault '0',\n\t\t\t\t\ttime_backup \tint(10)\t\tNOT NULL \tdefault '0',\n\t\t\t\t\tlast_backup \tint(10) \tNOT NULL \tdefault '0',\n\t\t\t\t\tdata_backup \ttext \t\tNOT NULL,\n\t\t\t\t\tauto_backdel \tint(2) \t\tNOT NULL \tdefault '0',\n\t\t\t\t\ttime_backdel \tint(10) \tNOT NULL \tdefault '0',\n\t\t\t\t\tlast_backdel \tint(10) \tNOT NULL \tdefault '0'\n\t\t\t)";
$sql = serendipity_db_schema_import($q);
$q = "TRUNCATE TABLE {$serendipity['dbPrefix']}dma_sqlbackup";
$sql = serendipity_db_schema_import($q);
$q = "TRUNCATE TABLE {$serendipity['dbPrefix']}dma_htmlbackup";
$sql = serendipity_db_schema_import($q);
$q = "INSERT INTO {$serendipity['dbPrefix']}dma_sqlbackup (\n\t\t\t\t\tauto_backup,\n\t\t\t\t\ttime_backup,\n\t\t\t\t\tlast_backup,\n\t\t\t\t\tdata_backup,\n\t\t\t\t\tauto_backdel,\n\t\t\t\t\ttime_backdel,\n\t\t\t\t\tlast_backdel\n\t\t) VALUES (\n\t\t\t\t\t'0',\n\t\t\t\t\t'0',\n\t\t\t\t\t'0',\n\t\t\t\t\t'',\n\t\t\t\t\t'0',\n\t\t\t\t\t'0',\n\t\t\t\t\t'0'\n\t\t)";
$sql = serendipity_db_schema_import($q);
$q = "INSERT INTO {$serendipity['dbPrefix']}dma_htmlbackup (\n\t\t\t\t\tauto_backup,\n\t\t\t\t\ttime_backup,\n\t\t\t\t\tlast_backup,\n\t\t\t\t\tdata_backup,\n\t\t\t\t\tauto_backdel,\n\t\t\t\t\ttime_backdel,\n\t\t\t\t\tlast_backdel\n\t\t) VALUES (\n\t\t\t\t\t'0',\n\t\t\t\t\t'0',\n\t\t\t\t\t'0',\n\t\t\t\t\t'',\n\t\t\t\t\t'0',\n\t\t\t\t\t'0',\n\t\t\t\t\t'0'\n\t\t)";
$sql = serendipity_db_schema_import($q);
}
示例14: checkScheme
function checkScheme()
{
global $serendipity;
$version = $this->get_config('version', '0.9');
if ($version != PLUGIN_EVENT_PHOTOBLOG_VERSION) {
if ((double) $version < 1.0) {
$q = "CREATE TABLE {$serendipity['dbPrefix']}photoblog (\n entryid int(11) default null,\n photoid int(11) default null\n )";
$sql = serendipity_db_schema_import($q);
$q = "CREATE INDEX kentryid ON {$serendipity['dbPrefix']}photoblog (entryid);";
$sql = serendipity_db_schema_import($q);
}
if ((double) $version < 1.2) {
$q = "ALTER TABLE {$serendipity['dbPrefix']}photoblog ADD use_thumbnail {BOOLEAN};";
$sql = serendipity_db_schema_import($q);
$q = "UPDATE {$serendipity['dbPrefix']}photoblog SET use_thumbnail = '';";
serendipity_db_query($q);
}
$this->set_config('version', PLUGIN_EVENT_PHOTOBLOG_VERSION);
}
}
示例15: install
static function install(&$obj)
{
global $serendipity;
$dbversion = $obj->get_config(PLUGIN_EVENT_COMMENTSPICE_CNAME_DBCONFIG);
if (empty($dbversion)) {
$dbversion = 0;
}
if (!DbSpice::table_created('commentspice')) {
// twitternames cant be longer than 15 referring to API docs. 20 for safety. nvarchar because of unicode names
$q = "create table {$serendipity['dbPrefix']}commentspice (" . "commentid int(10) not null, " . "twittername nvarchar(20), " . "primary key (commentid)" . ")";
$result = serendipity_db_schema_import($q);
if ($result !== true) {
return;
}
$obj->set_config(PLUGIN_EVENT_COMMENTSPICE_CNAME_DBCONFIG, 1);
}
// Version 2 updates
if ($obj->get_config(PLUGIN_EVENT_COMMENTSPICE_CNAME_DBCONFIG < 2)) {
$q = "alter table {$serendipity['dbPrefix']}commentspice" . " add column promo_name nvarchar(200)," . " add column promo_url nvarchar(250);";
serendipity_db_query($q);
$obj->set_config(PLUGIN_EVENT_COMMENTSPICE_CNAME_DBCONFIG, 2);
}
// Version 3 updates
if ($obj->get_config(PLUGIN_EVENT_COMMENTSPICE_CNAME_DBCONFIG < 3)) {
$q = "CREATE INDEX IDX_COMMENTS_EMAIL" . " on {$serendipity['dbPrefix']}comments (email);";
serendipity_db_query($q);
// if it already exists, it won't be created
$obj->set_config(PLUGIN_EVENT_COMMENTSPICE_CNAME_DBCONFIG, 3);
}
// Version 4 updates
if ($obj->get_config(PLUGIN_EVENT_COMMENTSPICE_CNAME_DBCONFIG < 4)) {
$q = "alter table {$serendipity['dbPrefix']}commentspice" . " add column boo nvarchar(250);";
serendipity_db_query($q);
$obj->set_config(PLUGIN_EVENT_COMMENTSPICE_CNAME_DBCONFIG, 4);
}
}