diff options
205 files changed, 4585 insertions, 3214 deletions
diff --git a/Zotlabs/Lib/DB_Upgrade.php b/Zotlabs/Lib/DB_Upgrade.php index 8f0488f6f..4038a2d53 100644 --- a/Zotlabs/Lib/DB_Upgrade.php +++ b/Zotlabs/Lib/DB_Upgrade.php @@ -10,22 +10,12 @@ class DB_Upgrade { function __construct($db_revision) { - $platform_name = System::get_platform_name(); + $this->config_name = 'db_version'; + $this->func_prefix = '_'; - $update_file = 'install/' . $platform_name . '/update.php'; - if(! file_exists($update_file)) { - $update_file = 'install/update.php'; - $this->config_name = 'db_version'; - $this->func_prefix = 'update_r'; - } - else { - $this->config_name = $platform_name . '_db_version'; - $this->func_prefix = $platform_name . '_update_'; - } - - $build = get_config('system', $this->config_name, 0); + $build = get_config('system', 'db_version', 0); if(! intval($build)) - $build = set_config('system', $this->config_name, $db_revision); + $build = set_config('system', 'db_version', $db_revision); if($build == $db_revision) { // Nothing to be done. @@ -40,82 +30,78 @@ class DB_Upgrade { $current = intval($db_revision); - if(($stored < $current) && file_exists($update_file)) { + if($stored < $current) { - Config::Load('database'); + // The last update we performed was $stored. + // Start at $stored + 1 and continue until we have completed $current - // We're reporting a different version than what is currently installed. - // Run any existing update scripts to bring the database up to current. - - require_once($update_file); + for($x = $stored + 1; $x <= $current; $x ++) { + $s = '_' . $x; + $cls = '\\Zotlabs\Update\\' . $s ; + if(! class_exists($cls)) { + return; + } - // make sure that boot.php and update.php are the same release, we might be - // updating from git right this very second and the correct version of the update.php - // file may not be here yet. This can happen on a very busy site. + // There could be a lot of processes running or about to run. + // We want exactly one process to run the update command. + // So store the fact that we're taking responsibility + // after first checking to see if somebody else already has. - if($db_revision == UPDATE_VERSION) { - for($x = $stored; $x < $current; $x ++) { - $func = $this->func_prefix . $x; - if(function_exists($func)) { - // There could be a lot of processes running or about to run. - // We want exactly one process to run the update command. - // So store the fact that we're taking responsibility - // after first checking to see if somebody else already has. + // If the update fails or times-out completely you may need to + // delete the config entry to try again. - // If the update fails or times-out completely you may need to - // delete the config entry to try again. + Config::Load('database'); - if(get_config('database', $func)) - break; - set_config('database',$func, '1'); - // call the specific update + if(get_config('database', $s)) + break; + set_config('database',$s, '1'); + - $retval = $func(); - if($retval) { + $c = new $cls(); + $retval = $c->run(); - // Prevent sending hundreds of thousands of emails by creating - // a lockfile. + if($retval != UPDATE_SUCCESS) { - $lockfile = 'store/[data]/mailsent'; + // Prevent sending hundreds of thousands of emails by creating + // a lockfile. - if ((file_exists($lockfile)) && (filemtime($lockfile) > (time() - 86400))) - return; - @unlink($lockfile); - //send the administrator an e-mail - file_put_contents($lockfile, $x); - - $r = q("select account_language from account where account_email = '%s' limit 1", - dbesc(\App::$config['system']['admin_email']) - ); - push_lang(($r) ? $r[0]['account_language'] : 'en'); + $lockfile = 'store/[data]/mailsent'; - z_mail( + if ((file_exists($lockfile)) && (filemtime($lockfile) > (time() - 86400))) + return; + @unlink($lockfile); + //send the administrator an e-mail + file_put_contents($lockfile, $x); + + $r = q("select account_language from account where account_email = '%s' limit 1", + dbesc(\App::$config['system']['admin_email']) + ); + push_lang(($r) ? $r[0]['account_language'] : 'en'); + z_mail( + [ + 'toEmail' => \App::$config['system']['admin_email'], + 'messageSubject' => sprintf( t('Update Error at %s'), z_root()), + 'textVersion' => replace_macros(get_intltext_template('update_fail_eml.tpl'), [ - 'toEmail' => \App::$config['system']['admin_email'], - 'messageSubject' => sprintf( t('Update Error at %s'), z_root()), - 'textVersion' => replace_macros(get_intltext_template('update_fail_eml.tpl'), - [ - '$sitename' => \App::$config['system']['sitename'], - '$siteurl' => z_root(), - '$update' => $x, - '$error' => sprintf( t('Update %s failed. See error logs.'), $x) - ] - ) + '$sitename' => \App::$config['system']['sitename'], + '$siteurl' => z_root(), + '$update' => $x, + '$error' => sprintf( t('Update %s failed. See error logs.'), $x) ] - ); - - //try the logger - logger('CRITICAL: Update Failed: ' . $x); - pop_lang(); - } - else { - set_config('database',$func, 'success'); - } - } + ) + ] + ); + + //try the logger + logger('CRITICAL: Update Failed: ' . $x); + pop_lang(); + } + else { + set_config('database',$s, 'success'); } - set_config('system', $this->config_name, $db_revision); } } + set_config('system', 'db_version', $db_revision); } } }
\ No newline at end of file diff --git a/Zotlabs/Module/Admin/Dbsync.php b/Zotlabs/Module/Admin/Dbsync.php index cff8a2484..469af2aa5 100644 --- a/Zotlabs/Module/Admin/Dbsync.php +++ b/Zotlabs/Module/Admin/Dbsync.php @@ -7,36 +7,38 @@ namespace Zotlabs\Module\Admin; class Dbsync { - - function get() { $o = ''; if(argc() > 3 && intval(argv(3)) && argv(2) === 'mark') { - set_config('database', 'update_r' . intval(argv(3)), 'success'); - if(intval(get_config('system','db_version')) <= intval(argv(3))) - set_config('system','db_version',intval(argv(3)) + 1); + // remove the old style config if it exists + del_config('database', 'update_r' . intval(argv(3))); + set_config('database', '_' . intval(argv(3)), 'success'); + if(intval(get_config('system','db_version')) < intval(argv(3))) + set_config('system','db_version',intval(argv(3))); info( t('Update has been marked successful') . EOL); goaway(z_root() . '/admin/dbsync'); } if(argc() > 2 && intval(argv(2))) { - require_once('install/update.php'); - $func = 'update_r' . intval(argv(2)); - if(function_exists($func)) { - $retval = $func(); + $x = intval(argv(2)); + $s = '_' . $x; + $cls = '\\Zotlabs\Update\\' . $s ; + if(class_exists($cls)) { + $c = new $cls(); + $retval = $c->run(); if($retval === UPDATE_FAILED) { - $o .= sprintf( t('Executing %s failed. Check system logs.'), $func); + $o .= sprintf( t('Executing %s failed. Check system logs.'), $s); } elseif($retval === UPDATE_SUCCESS) { - $o .= sprintf( t('Update %s was successfully applied.'), $func); - set_config('database',$func, 'success'); + $o .= sprintf( t('Update %s was successfully applied.'), $s); + set_config('database',$s, 'success'); } else - $o .= sprintf( t('Update %s did not return a status. Unknown if it succeeded.'), $func); + $o .= sprintf( t('Update %s did not return a status. Unknown if it succeeded.'), $s); } else - $o .= sprintf( t('Update function %s could not be found.'), $func); + $o .= sprintf( t('Update function %s could not be found.'), $s); return $o; } @@ -45,23 +47,25 @@ class Dbsync { $r = q("select * from config where cat = 'database' "); if(count($r)) { foreach($r as $rr) { - $upd = intval(substr($rr['k'],8)); + $upd = intval(substr($rr['k'],-4)); if($rr['v'] === 'success') continue; $failed[] = $upd; } } - if(! count($failed)) - return '<div class="generic-content-wrapper-styled"><h3>' . t('No failed updates.') . '</h3></div>'; - - $o = replace_macros(get_markup_template('failed_updates.tpl'),array( - '$base' => z_root(), - '$banner' => t('Failed Updates'), - '$desc' => '', - '$mark' => t('Mark success (if update was manually applied)'), - '$apply' => t('Attempt to execute this update step automatically'), - '$failed' => $failed + if(count($failed)) { + $o = replace_macros(get_markup_template('failed_updates.tpl'),array( + '$base' => z_root(), + '$banner' => t('Failed Updates'), + '$desc' => '', + '$mark' => t('Mark success (if update was manually applied)'), + '$apply' => t('Attempt to execute this update step automatically'), + '$failed' => $failed )); + } + else { + return '<div class="generic-content-wrapper-styled"><h3>' . t('No failed updates.') . '</h3></div>'; + } return $o; } diff --git a/Zotlabs/Update/_1000.php b/Zotlabs/Update/_1000.php new file mode 100644 index 000000000..02787db38 --- /dev/null +++ b/Zotlabs/Update/_1000.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1000 { +function run() { + $r = q("ALTER TABLE `channel` ADD `channel_a_delegate` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0', ADD INDEX ( `channel_a_delegate` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1001.php b/Zotlabs/Update/_1001.php new file mode 100644 index 000000000..9acc96373 --- /dev/null +++ b/Zotlabs/Update/_1001.php @@ -0,0 +1,27 @@ +<?php + +namespace Zotlabs\Update; + +class _1001 { +function run() { + $r = q("CREATE TABLE if not exists `verify` ( + `id` INT(10) UNSIGNED NOT NULL , + `channel` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `type` CHAR( 32 ) NOT NULL DEFAULT '', + `token` CHAR( 255 ) NOT NULL DEFAULT '', + `meta` CHAR( 255 ) NOT NULL DEFAULT '', + `created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', + PRIMARY KEY ( `id` ) + ) ENGINE = MYISAM DEFAULT CHARSET=utf8"); + + $r2 = q("alter table `verify` add index (`channel`), add index (`type`), add index (`token`), + add index (`meta`), add index (`created`)"); + + if($r && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1002.php b/Zotlabs/Update/_1002.php new file mode 100644 index 000000000..1f42449c6 --- /dev/null +++ b/Zotlabs/Update/_1002.php @@ -0,0 +1,20 @@ +<?php + +namespace Zotlabs\Update; + +class _1002 { +function run() { + $r = q("ALTER TABLE `event` CHANGE `account` `aid` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); + $r2 = q("alter table `event` drop index `account`, add index (`aid`)"); + + q("drop table contact"); + q("drop table deliverq"); + + if($r && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1003.php b/Zotlabs/Update/_1003.php new file mode 100644 index 000000000..18d99f985 --- /dev/null +++ b/Zotlabs/Update/_1003.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1003 { +function run() { + $r = q("ALTER TABLE `xchan` ADD `xchan_flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `xchan_network` , +ADD INDEX ( `xchan_flags` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1004.php b/Zotlabs/Update/_1004.php new file mode 100644 index 000000000..a86f5d824 --- /dev/null +++ b/Zotlabs/Update/_1004.php @@ -0,0 +1,24 @@ +<?php + +namespace Zotlabs\Update; + +class _1004 { +function run() { + $r = q("CREATE TABLE if not exists `site` ( +`site_url` CHAR( 255 ) NOT NULL , +`site_flags` INT NOT NULL DEFAULT '0', +`site_update` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', +`site_directory` CHAR( 255 ) NOT NULL DEFAULT '', +PRIMARY KEY ( `site_url` ) +) ENGINE = MYISAM DEFAULT CHARSET=utf8"); + + $r2 = q("alter table site add index (site_flags), add index (site_update), add index (site_directory) "); + + if($r && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1005.php b/Zotlabs/Update/_1005.php new file mode 100644 index 000000000..ee8621a8d --- /dev/null +++ b/Zotlabs/Update/_1005.php @@ -0,0 +1,13 @@ +<?php + +namespace Zotlabs\Update; + +class _1005 { +function run() { + q("drop table guid"); + q("drop table `notify-threads`"); + return UPDATE_SUCCESS; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1006.php b/Zotlabs/Update/_1006.php new file mode 100644 index 000000000..43a2bb951 --- /dev/null +++ b/Zotlabs/Update/_1006.php @@ -0,0 +1,45 @@ +<?php + +namespace Zotlabs\Update; + +class _1006 { +function run() { + + $r = q("CREATE TABLE IF NOT EXISTS `xprof` ( + `xprof_hash` char(255) NOT NULL, + `xprof_desc` char(255) NOT NULL DEFAULT '', + `xprof_dob` char(12) NOT NULL DEFAULT '', + `xprof_gender` char(255) NOT NULL DEFAULT '', + `xprof_marital` char(255) NOT NULL DEFAULT '', + `xprof_sexual` char(255) NOT NULL DEFAULT '', + `xprof_locale` char(255) NOT NULL DEFAULT '', + `xprof_region` char(255) NOT NULL DEFAULT '', + `xprof_postcode` char(32) NOT NULL DEFAULT '', + `xprof_country` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`xprof_hash`), + KEY `xprof_desc` (`xprof_desc`), + KEY `xprof_dob` (`xprof_dob`), + KEY `xprof_gender` (`xprof_gender`), + KEY `xprof_marital` (`xprof_marital`), + KEY `xprof_sexual` (`xprof_sexual`), + KEY `xprof_locale` (`xprof_locale`), + KEY `xprof_region` (`xprof_region`), + KEY `xprof_postcode` (`xprof_postcode`), + KEY `xprof_country` (`xprof_country`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8"); + + $r2 = q("CREATE TABLE IF NOT EXISTS `xtag` ( + `xtag_hash` char(255) NOT NULL, + `xtag_term` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`xtag_hash`), + KEY `xtag_term` (`xtag_term`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8"); + + if($r && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1007.php b/Zotlabs/Update/_1007.php new file mode 100644 index 000000000..eb52c5bc5 --- /dev/null +++ b/Zotlabs/Update/_1007.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1007 { +function run() { + $r = q("ALTER TABLE `channel` ADD `channel_r_storage` INT UNSIGNED NOT NULL DEFAULT '128', ADD `channel_w_storage` INT UNSIGNED NOT NULL DEFAULT '128', add index ( channel_r_storage ), add index ( channel_w_storage )"); + + if($r && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1008.php b/Zotlabs/Update/_1008.php new file mode 100644 index 000000000..d5db24bc0 --- /dev/null +++ b/Zotlabs/Update/_1008.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1008 { +function run() { + $r = q("alter table profile drop prv_keywords, CHANGE `pub_keywords` `keywords` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, drop index pub_keywords"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1009.php b/Zotlabs/Update/_1009.php new file mode 100644 index 000000000..afb0d5e96 --- /dev/null +++ b/Zotlabs/Update/_1009.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1009 { +function run() { + $r = q("ALTER TABLE `xprof` ADD `xprof_keywords` TEXT NOT NULL"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1010.php b/Zotlabs/Update/_1010.php new file mode 100644 index 000000000..92405cce4 --- /dev/null +++ b/Zotlabs/Update/_1010.php @@ -0,0 +1,18 @@ +<?php + +namespace Zotlabs\Update; + +class _1010 { +function run() { + $r = q("ALTER TABLE `abook` ADD `abook_dob` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `abook_connnected` , +ADD INDEX ( `abook_dob` )"); + + $r2 = q("ALTER TABLE `profile` ADD `dob_tz` CHAR( 255 ) NOT NULL DEFAULT 'UTC' AFTER `dob`"); + + if($r && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1011.php b/Zotlabs/Update/_1011.php new file mode 100644 index 000000000..b6841a9fe --- /dev/null +++ b/Zotlabs/Update/_1011.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1011 { +function run() { + $r = q("ALTER TABLE `item` ADD `expires` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `edited` , +ADD INDEX ( `expires` )"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1012.php b/Zotlabs/Update/_1012.php new file mode 100644 index 000000000..3ae5caf65 --- /dev/null +++ b/Zotlabs/Update/_1012.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1012 { +function run() { + $r = q("ALTER TABLE `xchan` ADD `xchan_connurl` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_url` , +ADD INDEX ( `xchan_connurl` )"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1013.php b/Zotlabs/Update/_1013.php new file mode 100644 index 000000000..68fc9071d --- /dev/null +++ b/Zotlabs/Update/_1013.php @@ -0,0 +1,21 @@ +<?php + +namespace Zotlabs\Update; + +class _1013 { +function run() { + $r = q("CREATE TABLE if not exists `xlink` ( +`xlink_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , +`xlink_xchan` CHAR( 255 ) NOT NULL DEFAULT '', +`xlink_link` CHAR( 255 ) NOT NULL DEFAULT '', +`xlink_updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' +) ENGINE = MYISAM DEFAULT CHARSET=utf8"); + + $r2 = q("alter table xlink add index ( xlink_xchan ), add index ( xlink_link ), add index ( xlink_updated ) "); + if($r && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1014.php b/Zotlabs/Update/_1014.php new file mode 100644 index 000000000..e9b3a89e0 --- /dev/null +++ b/Zotlabs/Update/_1014.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1014 { +function run() { + $r = q("ALTER TABLE `verify` CHANGE `id` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1015.php b/Zotlabs/Update/_1015.php new file mode 100644 index 000000000..d9d2d2f27 --- /dev/null +++ b/Zotlabs/Update/_1015.php @@ -0,0 +1,19 @@ +<?php + +namespace Zotlabs\Update; + +class _1015 { +function run() { + $r = q("ALTER TABLE `channel` ADD `channel_r_pages` INT UNSIGNED NOT NULL DEFAULT '128', +ADD `channel_w_pages` INT UNSIGNED NOT NULL DEFAULT '128'"); + + $r2 = q("ALTER TABLE `channel` ADD INDEX ( `channel_r_pages` ) , ADD INDEX ( `channel_w_pages` ) "); + + if($r && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1016.php b/Zotlabs/Update/_1016.php new file mode 100644 index 000000000..93f71a474 --- /dev/null +++ b/Zotlabs/Update/_1016.php @@ -0,0 +1,39 @@ +<?php + +namespace Zotlabs\Update; + +class _1016 { +function run() { + + $r = q("CREATE TABLE IF NOT EXISTS `menu` ( + `menu_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `menu_channel_id` int(10) unsigned NOT NULL DEFAULT '0', + `menu_desc` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`menu_id`), + KEY `menu_channel_id` (`menu_channel_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + $r2 = q("CREATE TABLE IF NOT EXISTS `menu_item` ( + `mitem_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `mitem_link` char(255) NOT NULL DEFAULT '', + `mitem_desc` char(255) NOT NULL DEFAULT '', + `allow_cid` mediumtext NOT NULL, + `allow_gid` mediumtext NOT NULL, + `deny_cid` mediumtext NOT NULL, + `deny_gid` mediumtext NOT NULL, + `mitem_channel_id` int(10) unsigned NOT NULL, + `mitem_menu_id` int(10) unsigned NOT NULL DEFAULT '0', + `mitem_order` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`mitem_id`), + KEY `mitem_channel_id` (`mitem_channel_id`), + KEY `mitem_menu_id` (`mitem_menu_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + + if($r && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1017.php b/Zotlabs/Update/_1017.php new file mode 100644 index 000000000..429eda67b --- /dev/null +++ b/Zotlabs/Update/_1017.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1017 { +function run() { + $r = q("ALTER TABLE `event` CHANGE `cid` `event_xchan` CHAR( 255 ) NOT NULL DEFAULT '', ADD INDEX ( `event_xchan` ), drop index cid "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1018.php b/Zotlabs/Update/_1018.php new file mode 100644 index 000000000..546ebffca --- /dev/null +++ b/Zotlabs/Update/_1018.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1018 { +function run() { + $r = q("ALTER TABLE `event` ADD `event_hash` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `event_xchan` , +ADD INDEX ( `event_hash` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1019.php b/Zotlabs/Update/_1019.php new file mode 100644 index 000000000..a7103c98c --- /dev/null +++ b/Zotlabs/Update/_1019.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1019 { +function run() { + $r = q("ALTER TABLE `event` DROP `message_id` "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1020.php b/Zotlabs/Update/_1020.php new file mode 100644 index 000000000..c898f31c2 --- /dev/null +++ b/Zotlabs/Update/_1020.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1020 { +function run() { + $r = q("alter table photo drop `contact-id`, drop guid, drop index `resource-id`, add index ( `resource_id` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1021.php b/Zotlabs/Update/_1021.php new file mode 100644 index 000000000..72203fadb --- /dev/null +++ b/Zotlabs/Update/_1021.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1021 { +function run() { + + $r = q("ALTER TABLE `abook` CHANGE `abook_connnected` `abook_connected` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', + drop index `abook_connnected`, add index ( `abook_connected` ) "); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1022.php b/Zotlabs/Update/_1022.php new file mode 100644 index 000000000..7e13250c4 --- /dev/null +++ b/Zotlabs/Update/_1022.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1022 { +function run() { + $r = q("alter table attach add index ( filename ), add index ( filetype ), add index ( filesize ), add index ( created ), add index ( edited ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1023.php b/Zotlabs/Update/_1023.php new file mode 100644 index 000000000..0a8dd2f00 --- /dev/null +++ b/Zotlabs/Update/_1023.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1023 { +function run() { + $r = q("ALTER TABLE `item` ADD `revision` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `lang` , add index ( revision ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1024.php b/Zotlabs/Update/_1024.php new file mode 100644 index 000000000..004d8967a --- /dev/null +++ b/Zotlabs/Update/_1024.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1024 { +function run() { + $r = q("ALTER TABLE `attach` ADD `revision` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `filesize` , +ADD INDEX ( `revision` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1025.php b/Zotlabs/Update/_1025.php new file mode 100644 index 000000000..d498233b3 --- /dev/null +++ b/Zotlabs/Update/_1025.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1025 { +function run() { + $r = q("ALTER TABLE `attach` ADD `folder` CHAR( 64 ) NOT NULL DEFAULT '' AFTER `revision` , +ADD `flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `folder` , add index ( folder ), add index ( flags )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1026.php b/Zotlabs/Update/_1026.php new file mode 100644 index 000000000..d57fdec37 --- /dev/null +++ b/Zotlabs/Update/_1026.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1026 { +function run() { + $r = q("ALTER TABLE `item` ADD `mimetype` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `author_xchan` , +ADD INDEX ( `mimetype` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1027.php b/Zotlabs/Update/_1027.php new file mode 100644 index 000000000..04d09d202 --- /dev/null +++ b/Zotlabs/Update/_1027.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1027 { +function run() { + $r = q("ALTER TABLE `abook` ADD `abook_rating` INT NOT NULL DEFAULT '0' AFTER `abook_closeness` , +ADD INDEX ( `abook_rating` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1028.php b/Zotlabs/Update/_1028.php new file mode 100644 index 000000000..a58784a01 --- /dev/null +++ b/Zotlabs/Update/_1028.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1028 { +function run() { + $r = q("ALTER TABLE `xlink` ADD `xlink_rating` INT NOT NULL DEFAULT '0' AFTER `xlink_link` , +ADD INDEX ( `xlink_rating` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1029.php b/Zotlabs/Update/_1029.php new file mode 100644 index 000000000..7072647cb --- /dev/null +++ b/Zotlabs/Update/_1029.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1029 { +function run() { + $r = q("ALTER TABLE `channel` ADD `channel_deleted` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `channel_pageflags` , +ADD INDEX ( `channel_deleted` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1030.php b/Zotlabs/Update/_1030.php new file mode 100644 index 000000000..7aebde49e --- /dev/null +++ b/Zotlabs/Update/_1030.php @@ -0,0 +1,29 @@ +<?php + +namespace Zotlabs\Update; + +class _1030 { +function run() { + $r = q("CREATE TABLE IF NOT EXISTS `issue` ( +`issue_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , +`issue_created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', +`issue_updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', +`issue_assigned` CHAR( 255 ) NOT NULL , +`issue_priority` INT NOT NULL , +`issue_status` INT NOT NULL , +`issue_component` CHAR( 255 ) NOT NULL, +KEY `issue_created` (`issue_created`), +KEY `issue_updated` (`issue_updated`), +KEY `issue_assigned` (`issue_assigned`), +KEY `issue_priority` (`issue_priority`), +KEY `issue_status` (`issue_status`), +KEY `issue_component` (`issue_component`) +) ENGINE = MYISAM DEFAULT CHARSET=utf8"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1031.php b/Zotlabs/Update/_1031.php new file mode 100644 index 000000000..4463c9e04 --- /dev/null +++ b/Zotlabs/Update/_1031.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1031 { +function run() { + $r = q("ALTER TABLE `account` ADD `account_external` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `account_email` , +ADD INDEX ( `account_external` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1032.php b/Zotlabs/Update/_1032.php new file mode 100644 index 000000000..a9fbeca9e --- /dev/null +++ b/Zotlabs/Update/_1032.php @@ -0,0 +1,21 @@ +<?php + +namespace Zotlabs\Update; + +class _1032 { +function run() { + $r = q("CREATE TABLE if not exists `xign` ( +`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , +`uid` INT NOT NULL DEFAULT '0', +`xchan` CHAR( 255 ) NOT NULL DEFAULT '', +KEY `uid` (`uid`), +KEY `xchan` (`xchan`) +) ENGINE = MYISAM DEFAULT CHARSET = utf8"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1033.php b/Zotlabs/Update/_1033.php new file mode 100644 index 000000000..a201e1d1f --- /dev/null +++ b/Zotlabs/Update/_1033.php @@ -0,0 +1,29 @@ +<?php + +namespace Zotlabs\Update; + +class _1033 { +function run() { + $r = q("CREATE TABLE if not exists `shares` ( +`share_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , +`share_type` INT NOT NULL DEFAULT '0', +`share_target` INT UNSIGNED NOT NULL DEFAULT '0', +`share_xchan` CHAR( 255 ) NOT NULL DEFAULT '', +KEY `share_type` (`share_type`), +KEY `share_target` (`share_target`), +KEY `share_xchan` (`share_xchan`) +) ENGINE = MYISAM DEFAULT CHARSET = utf8"); + + // if these fail don't bother reporting it + + q("drop table gcign"); + q("drop table gcontact"); + q("drop table glink"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1034.php b/Zotlabs/Update/_1034.php new file mode 100644 index 000000000..646182cc0 --- /dev/null +++ b/Zotlabs/Update/_1034.php @@ -0,0 +1,20 @@ +<?php + +namespace Zotlabs\Update; + +class _1034 { +function run() { + $r = q("CREATE TABLE if not exists `updates` ( +`ud_hash` CHAR( 128 ) NOT NULL , +`ud_date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', +PRIMARY KEY ( `ud_hash` ), +KEY `ud_date` ( `ud_date` ) +) ENGINE = MYISAM DEFAULT CHARSET = utf8"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1035.php b/Zotlabs/Update/_1035.php new file mode 100644 index 000000000..44e95189d --- /dev/null +++ b/Zotlabs/Update/_1035.php @@ -0,0 +1,24 @@ +<?php + +namespace Zotlabs\Update; + +class _1035 { +function run() { + $r = q("CREATE TABLE if not exists `xconfig` ( +`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , +`xchan` CHAR( 255 ) NOT NULL , +`cat` CHAR( 255 ) NOT NULL , +`k` CHAR( 255 ) NOT NULL , +`v` MEDIUMTEXT NOT NULL, +KEY `xchan` ( `xchan` ), +KEY `cat` ( `cat` ), +KEY `k` ( `k` ) +) ENGINE = MYISAM DEFAULT CHARSET = utf8"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1036.php b/Zotlabs/Update/_1036.php new file mode 100644 index 000000000..700a82e12 --- /dev/null +++ b/Zotlabs/Update/_1036.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1036 { +function run() { + $r = q("ALTER TABLE `profile` ADD `channels` TEXT NOT NULL AFTER `contact` "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1037.php b/Zotlabs/Update/_1037.php new file mode 100644 index 000000000..a1ad20aa8 --- /dev/null +++ b/Zotlabs/Update/_1037.php @@ -0,0 +1,30 @@ +<?php + +namespace Zotlabs\Update; + +class _1037 { +function run() { + $r1 = q("ALTER TABLE `item` CHANGE `uri` `mid` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '', +CHANGE `parent_uri` `parent_mid` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '', + DROP INDEX `uri` , +ADD INDEX `mid` ( `mid` ), +DROP INDEX `parent_uri` , +ADD INDEX `parent_mid` ( `parent_mid` ), + DROP INDEX `uid_uri` , +ADD INDEX `uid_mid` ( `mid` , `uid` ) "); + + $r2 = q("ALTER TABLE `mail` CHANGE `uri` `mid` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , +CHANGE `parent_uri` `parent_mid` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , +DROP INDEX `uri` , +ADD INDEX `mid` ( `mid` ), + DROP INDEX `parent_uri` , +ADD INDEX `parent_mid` ( `parent_mid` ) "); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1038.php b/Zotlabs/Update/_1038.php new file mode 100644 index 000000000..b4a86f41e --- /dev/null +++ b/Zotlabs/Update/_1038.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1038 { +function run() { + $r = q("ALTER TABLE `manage` CHANGE `mid` `xchan` CHAR( 255 ) NOT NULL DEFAULT '', drop index `mid`, ADD INDEX ( `xchan` )"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1039.php b/Zotlabs/Update/_1039.php new file mode 100644 index 000000000..9214cdc4a --- /dev/null +++ b/Zotlabs/Update/_1039.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1039 { +function run() { + $r = q("ALTER TABLE `channel` CHANGE `channel_default_gid` `channel_default_group` CHAR( 255 ) NOT NULL DEFAULT ''"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1040.php b/Zotlabs/Update/_1040.php new file mode 100644 index 000000000..77dc75a48 --- /dev/null +++ b/Zotlabs/Update/_1040.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1040 { +function run() { + $r1 = q("ALTER TABLE `session` CHANGE `expire` `expire` BIGINT UNSIGNED NOT NULL "); + $r2 = q("ALTER TABLE `tokens` CHANGE `expires` `expires` BIGINT UNSIGNED NOT NULL "); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1041.php b/Zotlabs/Update/_1041.php new file mode 100644 index 000000000..4ed436e61 --- /dev/null +++ b/Zotlabs/Update/_1041.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1041 { +function run() { + $r = q("ALTER TABLE `outq` ADD `outq_driver` CHAR( 32 ) NOT NULL DEFAULT '' AFTER `outq_channel` "); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1042.php b/Zotlabs/Update/_1042.php new file mode 100644 index 000000000..56298b6a3 --- /dev/null +++ b/Zotlabs/Update/_1042.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1042 { +function run() { + $r = q("ALTER TABLE `hubloc` ADD `hubloc_updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', +ADD `hubloc_connected` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( `hubloc_updated` ), ADD INDEX ( `hubloc_connected` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1043.php b/Zotlabs/Update/_1043.php new file mode 100644 index 000000000..b28203731 --- /dev/null +++ b/Zotlabs/Update/_1043.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1043 { +function run() { + $r = q("ALTER TABLE `item` ADD `comment_policy` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `coord` , +ADD INDEX ( `comment_policy` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1044.php b/Zotlabs/Update/_1044.php new file mode 100644 index 000000000..fc7e5438f --- /dev/null +++ b/Zotlabs/Update/_1044.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1044 { +function run() { + $r = q("ALTER TABLE `term` ADD `imgurl` CHAR( 255 ) NOT NULL , +ADD INDEX ( `imgurl` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1045.php b/Zotlabs/Update/_1045.php new file mode 100644 index 000000000..73570c316 --- /dev/null +++ b/Zotlabs/Update/_1045.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1045 { +function run() { + $r = q("ALTER TABLE `site` ADD `site_register` INT NOT NULL DEFAULT '0', +ADD INDEX ( `site_register` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1046.php b/Zotlabs/Update/_1046.php new file mode 100644 index 000000000..219d53e17 --- /dev/null +++ b/Zotlabs/Update/_1046.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1046 { +function run() { + $r = q("ALTER TABLE `term` ADD `term_hash` CHAR( 255 ) NOT NULL DEFAULT '', +ADD INDEX ( `term_hash` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1047.php b/Zotlabs/Update/_1047.php new file mode 100644 index 000000000..930c13eb8 --- /dev/null +++ b/Zotlabs/Update/_1047.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1047 { +function run() { + $r = q("ALTER TABLE `xprof` ADD `xprof_age` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `xprof_hash` , +ADD INDEX ( `xprof_age` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1048.php b/Zotlabs/Update/_1048.php new file mode 100644 index 000000000..20c8931d7 --- /dev/null +++ b/Zotlabs/Update/_1048.php @@ -0,0 +1,29 @@ +<?php + +namespace Zotlabs\Update; + +class _1048 { +function run() { + $r = q("CREATE TABLE IF NOT EXISTS `obj` ( + `obj_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `obj_page` char(64) NOT NULL DEFAULT '', + `obj_verb` char(255) NOT NULL DEFAULT '', + `obj_type` int(10) unsigned NOT NULL DEFAULT '0', + `obj_obj` char(255) NOT NULL DEFAULT '', + `obj_channel` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`obj_id`), + KEY `obj_verb` (`obj_verb`), + KEY `obj_page` (`obj_page`), + KEY `obj_type` (`obj_type`), + KEY `obj_channel` (`obj_channel`), + KEY `obj_obj` (`obj_obj`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1049.php b/Zotlabs/Update/_1049.php new file mode 100644 index 000000000..622847727 --- /dev/null +++ b/Zotlabs/Update/_1049.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1049 { +function run() { + $r = q("ALTER TABLE `term` ADD `parent_hash` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `term_hash` , ADD INDEX ( `parent_hash` ) "); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1050.php b/Zotlabs/Update/_1050.php new file mode 100644 index 000000000..1939d346f --- /dev/null +++ b/Zotlabs/Update/_1050.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1050 { +function run() { + $r = q("ALTER TABLE `xtag` DROP PRIMARY KEY , ADD `xtag_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST , ADD INDEX ( `xtag_hash` ) "); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1051.php b/Zotlabs/Update/_1051.php new file mode 100644 index 000000000..041b51f21 --- /dev/null +++ b/Zotlabs/Update/_1051.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1051 { +function run() { + $r = q("ALTER TABLE `photo` ADD `photo_flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `profile` , ADD INDEX ( `photo_flags` ) "); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1052.php b/Zotlabs/Update/_1052.php new file mode 100644 index 000000000..05addf21f --- /dev/null +++ b/Zotlabs/Update/_1052.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1052 { +function run() { + $r = q("ALTER TABLE `channel` ADD UNIQUE (`channel_address`) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1053.php b/Zotlabs/Update/_1053.php new file mode 100644 index 000000000..4752dca62 --- /dev/null +++ b/Zotlabs/Update/_1053.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1053 { +function run() { + $r = q("ALTER TABLE `profile` ADD `chandesc` TEXT NOT NULL DEFAULT '' AFTER `pdesc` "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1054.php b/Zotlabs/Update/_1054.php new file mode 100644 index 000000000..f4fc2eb5b --- /dev/null +++ b/Zotlabs/Update/_1054.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1054 { +function run() { + $r = q("ALTER TABLE `item` CHANGE `title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1055.php b/Zotlabs/Update/_1055.php new file mode 100644 index 000000000..6b3a4c1d9 --- /dev/null +++ b/Zotlabs/Update/_1055.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1055 { +function run() { + $r = q("ALTER TABLE `mail` CHANGE `title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1056.php b/Zotlabs/Update/_1056.php new file mode 100644 index 000000000..6c0510f88 --- /dev/null +++ b/Zotlabs/Update/_1056.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1056 { +function run() { + $r = q("ALTER TABLE `xchan` ADD `xchan_instance_url` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_network` , +ADD INDEX ( `xchan_instance_url` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1057.php b/Zotlabs/Update/_1057.php new file mode 100644 index 000000000..081e82d1f --- /dev/null +++ b/Zotlabs/Update/_1057.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1057 { +function run() { + $r = q("drop table intro"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1058.php b/Zotlabs/Update/_1058.php new file mode 100644 index 000000000..8e3ffdd6a --- /dev/null +++ b/Zotlabs/Update/_1058.php @@ -0,0 +1,19 @@ +<?php + +namespace Zotlabs\Update; + +class _1058 { +function run() { + $r1 = q("ALTER TABLE `menu` ADD `menu_name` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `menu_channel_id` , +ADD INDEX ( `menu_name` ) "); + + $r2 = q("ALTER TABLE `menu_item` ADD `mitem_flags` INT NOT NULL DEFAULT '0' AFTER `mitem_desc` , +ADD INDEX ( `mitem_flags` ) "); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1059.php b/Zotlabs/Update/_1059.php new file mode 100644 index 000000000..e035efb2c --- /dev/null +++ b/Zotlabs/Update/_1059.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1059 { +function run() { + $r = q("ALTER TABLE `mail` ADD `attach` MEDIUMTEXT NOT NULL DEFAULT '' AFTER `body` "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1060.php b/Zotlabs/Update/_1060.php new file mode 100644 index 000000000..5182b803a --- /dev/null +++ b/Zotlabs/Update/_1060.php @@ -0,0 +1,24 @@ +<?php + +namespace Zotlabs\Update; + +class _1060 { +function run() { + + $r = q("CREATE TABLE IF NOT EXISTS `vote` ( + `vote_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `vote_poll` int(11) NOT NULL DEFAULT '0', + `vote_element` int(11) NOT NULL DEFAULT '0', + `vote_result` text NOT NULL, + `vote_xchan` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`vote_id`), + UNIQUE KEY `vote_vote` (`vote_poll`,`vote_element`,`vote_xchan`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1061.php b/Zotlabs/Update/_1061.php new file mode 100644 index 000000000..e7af5bcb1 --- /dev/null +++ b/Zotlabs/Update/_1061.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1061 { +function run() { + $r = q("ALTER TABLE `vote` ADD INDEX ( `vote_poll` ), ADD INDEX ( `vote_element` ) "); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1062.php b/Zotlabs/Update/_1062.php new file mode 100644 index 000000000..39aa80e8a --- /dev/null +++ b/Zotlabs/Update/_1062.php @@ -0,0 +1,34 @@ +<?php + +namespace Zotlabs\Update; + +class _1062 { +function run() { + $r1 = q("CREATE TABLE IF NOT EXISTS `poll` ( +`poll_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , +`poll_channel` INT UNSIGNED NOT NULL DEFAULT '0', +`poll_desc` TEXT NOT NULL DEFAULT '', +`poll_flags` INT NOT NULL DEFAULT '0', +`poll_votes` INT NOT NULL DEFAULT '0', +KEY `poll_channel` (`poll_channel`), +KEY `poll_flags` (`poll_flags`), +KEY `poll_votes` (`poll_votes`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + $r2 = q("CREATE TABLE IF NOT EXISTS `poll_elm` ( +`pelm_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , +`pelm_poll` INT UNSIGNED NOT NULL DEFAULT '0', +`pelm_desc` TEXT NOT NULL DEFAULT '', +`pelm_flags` INT NOT NULL DEFAULT '0', +`pelm_result` FLOAT NOT NULL DEFAULT '0', +KEY `pelm_poll` (`pelm_poll`), +KEY `pelm_result` (`pelm_result`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1063.php b/Zotlabs/Update/_1063.php new file mode 100644 index 000000000..04d523df6 --- /dev/null +++ b/Zotlabs/Update/_1063.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1063 { +function run() { + $r = q("ALTER TABLE `xchan` ADD `xchan_follow` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_connurl` , +ADD `xchan_connpage` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_follow` , +ADD INDEX ( `xchan_follow` ), ADD INDEX ( `xchan_connpage`) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1064.php b/Zotlabs/Update/_1064.php new file mode 100644 index 000000000..295dd96c5 --- /dev/null +++ b/Zotlabs/Update/_1064.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1064 { +function run() { + $r = q("ALTER TABLE `updates` ADD `ud_guid` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `ud_hash` , +ADD INDEX ( `ud_guid` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1065.php b/Zotlabs/Update/_1065.php new file mode 100644 index 000000000..0a3e9082e --- /dev/null +++ b/Zotlabs/Update/_1065.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1065 { +function run() { + $r = q("ALTER TABLE `item` DROP `wall`, ADD `layout_mid` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `target` , +ADD INDEX ( `layout_mid` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1066.php b/Zotlabs/Update/_1066.php new file mode 100644 index 000000000..e7d3fbbb4 --- /dev/null +++ b/Zotlabs/Update/_1066.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1066 { +function run() { + $r = q("ALTER TABLE `site` ADD `site_access` INT NOT NULL DEFAULT '0' AFTER `site_url` , +ADD INDEX ( `site_access` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1067.php b/Zotlabs/Update/_1067.php new file mode 100644 index 000000000..94782a15e --- /dev/null +++ b/Zotlabs/Update/_1067.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1067 { +function run() { + $r = q("ALTER TABLE `updates` DROP PRIMARY KEY , ADD `ud_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST, ADD INDEX ( `ud_hash` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1068.php b/Zotlabs/Update/_1068.php new file mode 100644 index 000000000..e2a70684f --- /dev/null +++ b/Zotlabs/Update/_1068.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1068 { +function run(){ + $r = q("ALTER TABLE `hubloc` ADD `hubloc_status` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `hubloc_flags` , ADD INDEX ( `hubloc_status` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1069.php b/Zotlabs/Update/_1069.php new file mode 100644 index 000000000..437c7ffef --- /dev/null +++ b/Zotlabs/Update/_1069.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1069 { +function run() { + $r = q("ALTER TABLE `site` ADD `site_sellpage` CHAR( 255 ) NOT NULL DEFAULT '', +ADD INDEX ( `site_sellpage` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1070.php b/Zotlabs/Update/_1070.php new file mode 100644 index 000000000..2ec03f752 --- /dev/null +++ b/Zotlabs/Update/_1070.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1070 { +function run() { + $r = q("ALTER TABLE `updates` ADD `ud_flags` INT NOT NULL DEFAULT '0', +ADD INDEX ( `ud_flags` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1071.php b/Zotlabs/Update/_1071.php new file mode 100644 index 000000000..f4e627e7f --- /dev/null +++ b/Zotlabs/Update/_1071.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1071 { +function run() { + $r = q("ALTER TABLE `updates` ADD `ud_addr` CHAR( 255 ) NOT NULL DEFAULT '', +ADD INDEX ( `ud_addr` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1072.php b/Zotlabs/Update/_1072.php new file mode 100644 index 000000000..191893547 --- /dev/null +++ b/Zotlabs/Update/_1072.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1072 { +function run() { + $r = q("ALTER TABLE `xtag` ADD `xtag_flags` INT NOT NULL DEFAULT '0', +ADD INDEX ( `xtag_flags` ) "); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1073.php b/Zotlabs/Update/_1073.php new file mode 100644 index 000000000..f238d7a36 --- /dev/null +++ b/Zotlabs/Update/_1073.php @@ -0,0 +1,23 @@ +<?php + +namespace Zotlabs\Update; + +class _1073 { +function run() { + $r1 = q("CREATE TABLE IF NOT EXISTS `source` ( +`src_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , +`src_channel_id` INT UNSIGNED NOT NULL DEFAULT '0', +`src_channel_xchan` CHAR( 255 ) NOT NULL DEFAULT '', +`src_xchan` CHAR( 255 ) NOT NULL DEFAULT '', +`src_patt` MEDIUMTEXT NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + $r2 = q("ALTER TABLE `source` ADD INDEX ( `src_channel_id` ), ADD INDEX ( `src_channel_xchan` ), ADD INDEX ( `src_xchan` ) "); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1074.php b/Zotlabs/Update/_1074.php new file mode 100644 index 000000000..d331b935a --- /dev/null +++ b/Zotlabs/Update/_1074.php @@ -0,0 +1,19 @@ +<?php + +namespace Zotlabs\Update; + +class _1074 { +function run() { + $r1 = q("ALTER TABLE `site` ADD `site_sync` DATETIME NOT NULL AFTER `site_update` "); + + $r2 = q("ALTER TABLE `updates` ADD `ud_last` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `ud_date` , +ADD INDEX ( `ud_last` ) "); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1075.php b/Zotlabs/Update/_1075.php new file mode 100644 index 000000000..ac7c48f71 --- /dev/null +++ b/Zotlabs/Update/_1075.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1075 { +function run() { + $r = q("ALTER TABLE `channel` ADD `channel_a_republish` INT UNSIGNED NOT NULL DEFAULT '128', +ADD INDEX ( `channel_a_republish` )"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1076.php b/Zotlabs/Update/_1076.php new file mode 100644 index 000000000..c8c631822 --- /dev/null +++ b/Zotlabs/Update/_1076.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1076 { +function run() { + $r = q("ALTER TABLE `item` CHANGE `inform` `sig` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1077.php b/Zotlabs/Update/_1077.php new file mode 100644 index 000000000..3c23affbc --- /dev/null +++ b/Zotlabs/Update/_1077.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1077 { +function run() { + $r = q("ALTER TABLE `item` ADD `source_xchan` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `author_xchan` "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1078.php b/Zotlabs/Update/_1078.php new file mode 100644 index 000000000..c832a1c2a --- /dev/null +++ b/Zotlabs/Update/_1078.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1078 { +function run() { + $r = q("ALTER TABLE `channel` ADD `channel_dirdate` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `channel_pageflags` , ADD INDEX ( `channel_dirdate` )"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1079.php b/Zotlabs/Update/_1079.php new file mode 100644 index 000000000..b10e2e7ae --- /dev/null +++ b/Zotlabs/Update/_1079.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1079 { +function run() { + $r = q("ALTER TABLE `site` ADD `site_location` CHAR( 255 ) NOT NULL DEFAULT ''"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1080.php b/Zotlabs/Update/_1080.php new file mode 100644 index 000000000..ab9c4c2f8 --- /dev/null +++ b/Zotlabs/Update/_1080.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1080 { +function run() { + $r = q("ALTER TABLE `mail` ADD `expires` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', +ADD INDEX ( `expires` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1081.php b/Zotlabs/Update/_1081.php new file mode 100644 index 000000000..521a39893 --- /dev/null +++ b/Zotlabs/Update/_1081.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1081 { +function run() { + $r = q("DROP TABLE `queue` "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1082.php b/Zotlabs/Update/_1082.php new file mode 100644 index 000000000..8ce8d20c1 --- /dev/null +++ b/Zotlabs/Update/_1082.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1082 { +function run() { + $r = q("DROP TABLE `challenge` "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1083.php b/Zotlabs/Update/_1083.php new file mode 100644 index 000000000..becb2b702 --- /dev/null +++ b/Zotlabs/Update/_1083.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1083 { +function run() { + $r = q("ALTER TABLE `notify` ADD `aid` INT NOT NULL AFTER `msg` , +ADD INDEX ( `aid` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1084.php b/Zotlabs/Update/_1084.php new file mode 100644 index 000000000..621d0346d --- /dev/null +++ b/Zotlabs/Update/_1084.php @@ -0,0 +1,24 @@ +<?php + +namespace Zotlabs\Update; + +class _1084 { +function run() { + + + $r = q("CREATE TABLE if not exists `sys_perms` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , + `cat` CHAR( 255 ) NOT NULL , + `k` CHAR( 255 ) NOT NULL , + `v` MEDIUMTEXT NOT NULL, + `public_perm` TINYINT( 1 ) UNSIGNED NOT NULL +) ENGINE = MYISAM DEFAULT CHARSET = utf8"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1085.php b/Zotlabs/Update/_1085.php new file mode 100644 index 000000000..f50e56319 --- /dev/null +++ b/Zotlabs/Update/_1085.php @@ -0,0 +1,20 @@ +<?php + +namespace Zotlabs\Update; + +class _1085 { +function run() { + $r1 = q("ALTER TABLE `photo` CHANGE `desc` `description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL "); + + $r2 = q("RENAME TABLE `group` TO `groups`"); + + $r3 = q("ALTER TABLE `event` CHANGE `desc` `description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL "); + + if($r1 && $r2 && $r3) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1086.php b/Zotlabs/Update/_1086.php new file mode 100644 index 000000000..1b034daac --- /dev/null +++ b/Zotlabs/Update/_1086.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1086 { +function run() { + $r = q("ALTER TABLE `account` ADD `account_level` INT UNSIGNED NOT NULL DEFAULT '0', +ADD INDEX ( `account_level` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1087.php b/Zotlabs/Update/_1087.php new file mode 100644 index 000000000..839c16d91 --- /dev/null +++ b/Zotlabs/Update/_1087.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1087 { +function run() { + $r = q("ALTER TABLE `xprof` ADD `xprof_about` TEXT NOT NULL DEFAULT '', +ADD `xprof_homepage` CHAR( 255 ) NOT NULL DEFAULT '', +ADD `xprof_hometown` CHAR( 255 ) NOT NULL DEFAULT '', +ADD INDEX ( `xprof_hometown` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1088.php b/Zotlabs/Update/_1088.php new file mode 100644 index 000000000..5f478d0a1 --- /dev/null +++ b/Zotlabs/Update/_1088.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1088 { +function run() { + $r = q("ALTER TABLE `obj` ADD `allow_cid` MEDIUMTEXT NOT NULL DEFAULT '', +ADD `allow_gid` MEDIUMTEXT NOT NULL DEFAULT '', +ADD `deny_cid` MEDIUMTEXT NOT NULL DEFAULT '', +ADD `deny_gid` MEDIUMTEXT NOT NULL DEFAULT ''"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1089.php b/Zotlabs/Update/_1089.php new file mode 100644 index 000000000..0a8a1d55b --- /dev/null +++ b/Zotlabs/Update/_1089.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1089 { +function run() { + $r = q("ALTER TABLE `attach` ADD `creator` CHAR( 128 ) NOT NULL DEFAULT '' AFTER `hash` , +ADD INDEX ( `creator` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1090.php b/Zotlabs/Update/_1090.php new file mode 100644 index 000000000..efa7db7c2 --- /dev/null +++ b/Zotlabs/Update/_1090.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1090 { +function run() { + $r = q("ALTER TABLE `menu` ADD `menu_flags` INT NOT NULL DEFAULT '0', +ADD INDEX ( `menu_flags` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1091.php b/Zotlabs/Update/_1091.php new file mode 100644 index 000000000..ffb445c62 --- /dev/null +++ b/Zotlabs/Update/_1091.php @@ -0,0 +1,13 @@ +<?php + +namespace Zotlabs\Update; + +class _1091 { +function run() { + @os_mkdir('store/[data]/smarty3',STORAGE_DEFAULT_PERMISSIONS,true); + @file_put_contents('store/[data]/locks',''); + return UPDATE_SUCCESS; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1092.php b/Zotlabs/Update/_1092.php new file mode 100644 index 000000000..897c0c20b --- /dev/null +++ b/Zotlabs/Update/_1092.php @@ -0,0 +1,61 @@ +<?php + +namespace Zotlabs\Update; + +class _1092 { +function run() { + $r1 = q("CREATE TABLE IF NOT EXISTS `chat` ( + `chat_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `chat_room` int(10) unsigned NOT NULL DEFAULT '0', + `chat_xchan` char(255) NOT NULL DEFAULT '', + `chat_text` mediumtext NOT NULL, + `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + PRIMARY KEY (`chat_id`), + KEY `chat_room` (`chat_room`), + KEY `chat_xchan` (`chat_xchan`), + KEY `created` (`created`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8"); + + $r2 = q("CREATE TABLE IF NOT EXISTS `chatpresence` ( + `cp_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `cp_room` int(10) unsigned NOT NULL DEFAULT '0', + `cp_xchan` char(255) NOT NULL DEFAULT '', + `cp_last` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `cp_status` char(255) NOT NULL, + PRIMARY KEY (`cp_id`), + KEY `cp_room` (`cp_room`), + KEY `cp_xchan` (`cp_xchan`), + KEY `cp_last` (`cp_last`), + KEY `cp_status` (`cp_status`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8"); + + $r3 = q("CREATE TABLE IF NOT EXISTS `chatroom` ( + `cr_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `cr_aid` int(10) unsigned NOT NULL DEFAULT '0', + `cr_uid` int(10) unsigned NOT NULL DEFAULT '0', + `cr_name` char(255) NOT NULL DEFAULT '', + `cr_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `cr_edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `allow_cid` mediumtext NOT NULL, + `allow_gid` mediumtext NOT NULL, + `deny_cid` mediumtext NOT NULL, + `deny_gid` mediumtext NOT NULL, + PRIMARY KEY (`cr_id`), + KEY `cr_aid` (`cr_aid`), + KEY `cr_uid` (`cr_uid`), + KEY `cr_name` (`cr_name`), + KEY `cr_created` (`cr_created`), + KEY `cr_edited` (`cr_edited`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8"); + + + if($r1 && $r2 && $r3) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1093.php b/Zotlabs/Update/_1093.php new file mode 100644 index 000000000..eb692e0b7 --- /dev/null +++ b/Zotlabs/Update/_1093.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1093 { +function run() { + $r = q("ALTER TABLE `chatpresence` ADD `cp_client` CHAR( 128 ) NOT NULL DEFAULT ''"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1094.php b/Zotlabs/Update/_1094.php new file mode 100644 index 000000000..c502c7a06 --- /dev/null +++ b/Zotlabs/Update/_1094.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1094 { +function run() { + $r = q("ALTER TABLE `chatroom` ADD `cr_expire` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `cr_edited` , +ADD INDEX ( `cr_expire` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1095.php b/Zotlabs/Update/_1095.php new file mode 100644 index 000000000..0f11fda62 --- /dev/null +++ b/Zotlabs/Update/_1095.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1095 { +function run() { + $r = q("ALTER TABLE `channel` ADD `channel_a_bookmark` INT UNSIGNED NOT NULL DEFAULT '128', +ADD INDEX ( `channel_a_bookmark` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1096.php b/Zotlabs/Update/_1096.php new file mode 100644 index 000000000..67abb9ee2 --- /dev/null +++ b/Zotlabs/Update/_1096.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1096 { +function run() { + $r = q("ALTER TABLE `account` CHANGE `account_level` `account_level` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1097.php b/Zotlabs/Update/_1097.php new file mode 100644 index 000000000..bfe04cf5f --- /dev/null +++ b/Zotlabs/Update/_1097.php @@ -0,0 +1,24 @@ +<?php + +namespace Zotlabs\Update; + +class _1097 { +function run() { + + // fix some mangled hublocs from a bug long ago + + $r = q("select hubloc_id, hubloc_addr from hubloc where hubloc_addr like '%%/%%'"); + if($r) { + foreach($r as $rr) { + q("update hubloc set hubloc_addr = '%s' where hubloc_id = %d", + dbesc(substr($rr['hubloc_addr'],0,strpos($rr['hubloc_addr'],'/'))), + intval($rr['hubloc_id']) + ); + } + } + return UPDATE_SUCCESS; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1098.php b/Zotlabs/Update/_1098.php new file mode 100644 index 000000000..e74ba640c --- /dev/null +++ b/Zotlabs/Update/_1098.php @@ -0,0 +1,25 @@ +<?php + +namespace Zotlabs\Update; + +class _1098 { +function run() { + $r = q("ALTER TABLE `channel` CHANGE `channel_r_stream` `channel_r_stream` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); + $r2 = q("ALTER TABLE `channel` CHANGE `channel_r_profile` `channel_r_profile` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); + $r3 = q("ALTER TABLE `channel` CHANGE `channel_r_photos` `channel_r_photos` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); + $r4 = q("ALTER TABLE `channel` CHANGE `channel_r_abook` `channel_r_abook` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); + $r4 = q("ALTER TABLE `channel` CHANGE `channel_w_stream` `channel_w_stream` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); + $r5 = q("ALTER TABLE `channel` CHANGE `channel_w_wall` `channel_w_wall` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); + $r6 = q("ALTER TABLE `channel` CHANGE `channel_w_tagwall` `channel_w_tagwall` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); + $r7 = q("ALTER TABLE `channel` CHANGE `channel_w_comment` `channel_w_comment` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); + $r8 = q("ALTER TABLE `channel` CHANGE `channel_w_mail` `channel_w_mail` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); + $r9 = q("ALTER TABLE `channel` CHANGE `channel_w_photos` `channel_w_photos` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); + $r10 = q("ALTER TABLE `channel` CHANGE `channel_w_chat` `channel_w_chat` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); + $r11 = q("ALTER TABLE `channel` CHANGE `channel_a_delegate` `channel_a_delegate` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); + if($r && $r2 && $r3 && $r3 && $r5 && $r6 && $r7 && $r8 && $r9 && $r9 && $r10 && $r11) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1099.php b/Zotlabs/Update/_1099.php new file mode 100644 index 000000000..a49e38c7c --- /dev/null +++ b/Zotlabs/Update/_1099.php @@ -0,0 +1,24 @@ +<?php + +namespace Zotlabs\Update; + +class _1099 { +function run() { + $r = q("CREATE TABLE IF NOT EXISTS `xchat` ( + `xchat_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `xchat_url` char(255) NOT NULL DEFAULT '', + `xchat_desc` char(255) NOT NULL DEFAULT '', + `xchat_xchan` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`xchat_id`), + KEY `xchat_url` (`xchat_url`), + KEY `xchat_desc` (`xchat_desc`), + KEY `xchat_xchan` (`xchat_xchan`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1100.php b/Zotlabs/Update/_1100.php new file mode 100644 index 000000000..ffcd7dc1d --- /dev/null +++ b/Zotlabs/Update/_1100.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1100 { +function run() { + $r = q("ALTER TABLE `xchat` ADD `xchat_edited` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', +ADD INDEX ( `xchat_edited` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1101.php b/Zotlabs/Update/_1101.php new file mode 100644 index 000000000..709b6fa0a --- /dev/null +++ b/Zotlabs/Update/_1101.php @@ -0,0 +1,13 @@ +<?php + +namespace Zotlabs\Update; + +class _1101 { +function run() { + $r = q("update updates set ud_flags = 2 where ud_flags = (-1)"); + $r = q("update updates set ud_flags = 0 where ud_flags = 4096"); + return UPDATE_SUCCESS; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1102.php b/Zotlabs/Update/_1102.php new file mode 100644 index 000000000..d25979b1f --- /dev/null +++ b/Zotlabs/Update/_1102.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1102 { +function run() { + $r = q("update abook set abook_flags = (abook_flags - %d) + where ( abook_flags & %d)", + intval(ABOOK_FLAG_UNCONNECTED), + intval(ABOOK_FLAG_UNCONNECTED) + ); + return UPDATE_SUCCESS; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1103.php b/Zotlabs/Update/_1103.php new file mode 100644 index 000000000..3f9a9286c --- /dev/null +++ b/Zotlabs/Update/_1103.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1103 { +function run() { + $x = curl_version(); + if(stristr($x['ssl_version'],'openssl')) + set_config('system','curl_ssl_ciphers','ALL:!eNULL'); + return UPDATE_SUCCESS; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1104.php b/Zotlabs/Update/_1104.php new file mode 100644 index 000000000..0d299095b --- /dev/null +++ b/Zotlabs/Update/_1104.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1104 { +function run() { + $r = q("ALTER TABLE `item` ADD `route` TEXT NOT NULL DEFAULT '' AFTER `postopts` "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1105.php b/Zotlabs/Update/_1105.php new file mode 100644 index 000000000..a96600150 --- /dev/null +++ b/Zotlabs/Update/_1105.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1105 { +function run() { + $r = q("ALTER TABLE `site` ADD `site_pull` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `site_update` , +CHANGE `site_sync` `site_sync` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( `site_pull` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1106.php b/Zotlabs/Update/_1106.php new file mode 100644 index 000000000..7e13d8993 --- /dev/null +++ b/Zotlabs/Update/_1106.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1106 { +function run() { + $r = q("ALTER TABLE `notify` CHANGE `parent` `parent` CHAR( 255 ) NOT NULL DEFAULT ''"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1107.php b/Zotlabs/Update/_1107.php new file mode 100644 index 000000000..bcac6cf19 --- /dev/null +++ b/Zotlabs/Update/_1107.php @@ -0,0 +1,34 @@ +<?php + +namespace Zotlabs\Update; + +class _1107 { +function run() { + $r = q("CREATE TABLE IF NOT EXISTS `app` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `app_id` char(64) NOT NULL DEFAULT '', + `app_sig` char(255) NOT NULL DEFAULT '', + `app_author` char(255) NOT NULL DEFAULT '', + `app_name` char(255) NOT NULL DEFAULT '', + `app_desc` text NOT NULL, + `app_url` char(255) NOT NULL DEFAULT '', + `app_photo` char(255) NOT NULL DEFAULT '', + `app_version` char(255) NOT NULL DEFAULT '', + `app_channel` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `app_id` (`app_id`), + KEY `app_name` (`app_name`), + KEY `app_url` (`app_url`), + KEY `app_photo` (`app_photo`), + KEY `app_version` (`app_version`), + KEY `app_channel` (`app_channel`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1108.php b/Zotlabs/Update/_1108.php new file mode 100644 index 000000000..d9d9b0c18 --- /dev/null +++ b/Zotlabs/Update/_1108.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1108 { +function run() { + $r = q("ALTER TABLE `app` ADD `app_addr` CHAR( 255 ) NOT NULL DEFAULT '', +ADD `app_price` CHAR( 255 ) NOT NULL DEFAULT '', +ADD `app_page` CHAR( 255 ) NOT NULL DEFAULT '', +ADD INDEX ( `app_price` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1109.php b/Zotlabs/Update/_1109.php new file mode 100644 index 000000000..6a0aed28f --- /dev/null +++ b/Zotlabs/Update/_1109.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1109 { +function run() { + $r = q("ALTER TABLE `app` CHANGE `app_id` `app_id` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +// We ended up with an extra zero in the name for 1108, so do it over and ignore the result. + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1110.php b/Zotlabs/Update/_1110.php new file mode 100644 index 000000000..62bcbd0c8 --- /dev/null +++ b/Zotlabs/Update/_1110.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1110 { +function run() { + $r = q("ALTER TABLE `app` ADD `app_addr` CHAR( 255 ) NOT NULL DEFAULT '', +ADD `app_price` CHAR( 255 ) NOT NULL DEFAULT '', +ADD `app_page` CHAR( 255 ) NOT NULL DEFAULT '', +ADD INDEX ( `app_price` )"); + + return UPDATE_SUCCESS; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1111.php b/Zotlabs/Update/_1111.php new file mode 100644 index 000000000..a3080b465 --- /dev/null +++ b/Zotlabs/Update/_1111.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1111 { +function run() { + $r = q("ALTER TABLE `app` ADD `app_requires` CHAR( 255 ) NOT NULL DEFAULT '' "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1112.php b/Zotlabs/Update/_1112.php new file mode 100644 index 000000000..e81780519 --- /dev/null +++ b/Zotlabs/Update/_1112.php @@ -0,0 +1,29 @@ +<?php + +namespace Zotlabs\Update; + +class _1112 { +function run() { + $r = q("CREATE TABLE IF NOT EXISTS `likes` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `liker` char(128) NOT NULL DEFAULT '', + `likee` char(128) NOT NULL DEFAULT '', + `iid` int(11) NOT NULL DEFAULT '0', + `verb` char(255) NOT NULL DEFAULT '', + `target_type` char(255) NOT NULL DEFAULT '', + `target` mediumtext NOT NULL, + PRIMARY KEY (`id`), + KEY `liker` (`liker`), + KEY `likee` (`likee`), + KEY `iid` (`iid`), + KEY `verb` (`verb`), + KEY `target_type` (`target_type`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1113.php b/Zotlabs/Update/_1113.php new file mode 100644 index 000000000..0a726dcc3 --- /dev/null +++ b/Zotlabs/Update/_1113.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1113 { +function run() { + $r = q("ALTER TABLE `likes` ADD `channel_id` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `id` , +CHANGE `iid` `iid` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0', +ADD INDEX ( `channel_id` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1114.php b/Zotlabs/Update/_1114.php new file mode 100644 index 000000000..5b564d513 --- /dev/null +++ b/Zotlabs/Update/_1114.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1114 { +function run() { + $r = q("ALTER TABLE `likes` ADD `target_id` CHAR( 128 ) NOT NULL DEFAULT '' AFTER `target_type` , +ADD INDEX ( `target_id` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1115.php b/Zotlabs/Update/_1115.php new file mode 100644 index 000000000..4edf63b85 --- /dev/null +++ b/Zotlabs/Update/_1115.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1115 { +function run() { + + // Introducing email verification. Mark all existing accounts as verified or they + // won't be able to login. + + $r = q("update account set account_flags = (account_flags ^ 1) where (account_flags & 1) "); + return UPDATE_SUCCESS; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1116.php b/Zotlabs/Update/_1116.php new file mode 100644 index 000000000..9fa7270ea --- /dev/null +++ b/Zotlabs/Update/_1116.php @@ -0,0 +1,12 @@ +<?php + +namespace Zotlabs\Update; + +class _1116 { +function run() { + @os_mkdir('store/[data]/smarty3',STORAGE_DEFAULT_PERMISSIONS,true); + return UPDATE_SUCCESS; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1117.php b/Zotlabs/Update/_1117.php new file mode 100644 index 000000000..cc8edb3c9 --- /dev/null +++ b/Zotlabs/Update/_1117.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1117 { +function run() { + $r = q("ALTER TABLE `channel` CHANGE `channel_a_bookmark` `channel_w_like` INT( 10 ) UNSIGNED NOT NULL DEFAULT '128', +DROP INDEX `channel_a_bookmark` , ADD INDEX `channel_w_like` ( `channel_w_like` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1118.php b/Zotlabs/Update/_1118.php new file mode 100644 index 000000000..22cfc2357 --- /dev/null +++ b/Zotlabs/Update/_1118.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1118 { +function run() { + $r = q("ALTER TABLE `account` ADD `account_password_changed` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', +ADD INDEX ( `account_password_changed` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1119.php b/Zotlabs/Update/_1119.php new file mode 100644 index 000000000..ccf03e45a --- /dev/null +++ b/Zotlabs/Update/_1119.php @@ -0,0 +1,35 @@ +<?php + +namespace Zotlabs\Update; + +class _1119 { +function run() { + $r1 = q("CREATE TABLE IF NOT EXISTS `profdef` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `field_name` char(255) NOT NULL DEFAULT '', + `field_type` char(16) NOT NULL DEFAULT '', + `field_desc` char(255) NOT NULL DEFAULT '', + `field_help` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `field_name` (`field_name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8"); + + $r2 = q("CREATE TABLE IF NOT EXISTS `profext` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `channel_id` int(10) unsigned NOT NULL DEFAULT '0', + `hash` char(255) NOT NULL DEFAULT '', + `k` char(255) NOT NULL DEFAULT '', + `v` mediumtext NOT NULL, + PRIMARY KEY (`id`), + KEY `channel_id` (`channel_id`), + KEY `hash` (`hash`), + KEY `k` (`k`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8"); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1120.php b/Zotlabs/Update/_1120.php new file mode 100644 index 000000000..c1f7e98d7 --- /dev/null +++ b/Zotlabs/Update/_1120.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1120 { +function run() { + $r = q("ALTER TABLE `item` ADD `public_policy` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `coord` , +ADD INDEX ( `public_policy` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1121.php b/Zotlabs/Update/_1121.php new file mode 100644 index 000000000..c5ff00694 --- /dev/null +++ b/Zotlabs/Update/_1121.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1121 { +function run() { + $r = q("ALTER TABLE `site` ADD `site_realm` CHAR( 255 ) NOT NULL DEFAULT '', +ADD INDEX ( `site_realm` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1122.php b/Zotlabs/Update/_1122.php new file mode 100644 index 000000000..903e3aaeb --- /dev/null +++ b/Zotlabs/Update/_1122.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1122 { +function run() { + $r = q("update site set site_realm = '%s' where true", + dbesc(DIRECTORY_REALM) + ); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1123.php b/Zotlabs/Update/_1123.php new file mode 100644 index 000000000..96096beac --- /dev/null +++ b/Zotlabs/Update/_1123.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1123 { +function run() { + $r1 = q("ALTER TABLE `hubloc` ADD `hubloc_network` CHAR( 32 ) NOT NULL DEFAULT '' AFTER `hubloc_addr` , +ADD INDEX ( `hubloc_network` )"); + $r2 = q("update hubloc set hubloc_network = 'zot' where true"); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1124.php b/Zotlabs/Update/_1124.php new file mode 100644 index 000000000..1320b8b55 --- /dev/null +++ b/Zotlabs/Update/_1124.php @@ -0,0 +1,41 @@ +<?php + +namespace Zotlabs\Update; + +class _1124 { +function run() { + $r1 = q("CREATE TABLE IF NOT EXISTS `sign` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `iid` int(10) unsigned NOT NULL DEFAULT '0', + `retract_iid` int(10) unsigned NOT NULL DEFAULT '0', + `signed_text` mediumtext NOT NULL, + `signature` text NOT NULL, + `signer` char(255) NOT NULL, + PRIMARY KEY (`id`), + KEY `iid` (`iid`), + KEY `retract_iid` (`retract_iid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + $r2 = q("CREATE TABLE IF NOT EXISTS `conv` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `guid` char(255) NOT NULL, + `recips` mediumtext NOT NULL, + `uid` int(11) NOT NULL, + `creator` char(255) NOT NULL, + `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `subject` mediumtext NOT NULL, + PRIMARY KEY (`id`), + KEY `created` (`created`), + KEY `updated` (`updated`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1125.php b/Zotlabs/Update/_1125.php new file mode 100644 index 000000000..03f9640a4 --- /dev/null +++ b/Zotlabs/Update/_1125.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1125 { +function run() { + $r = q("ALTER TABLE `profdef` ADD `field_inputs` MEDIUMTEXT NOT NULL DEFAULT ''"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1126.php b/Zotlabs/Update/_1126.php new file mode 100644 index 000000000..f657cc6b2 --- /dev/null +++ b/Zotlabs/Update/_1126.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1126 { +function run() { + $r = q("ALTER TABLE `mail` ADD `convid` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `id` , +ADD INDEX ( `convid` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1127.php b/Zotlabs/Update/_1127.php new file mode 100644 index 000000000..8dec64ae4 --- /dev/null +++ b/Zotlabs/Update/_1127.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1127 { +function run() { + $r = q("ALTER TABLE `item` ADD `comments_closed` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `changed` , +ADD INDEX ( `comments_closed` ), ADD INDEX ( `changed` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1128.php b/Zotlabs/Update/_1128.php new file mode 100644 index 000000000..8ee6d225e --- /dev/null +++ b/Zotlabs/Update/_1128.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1128 { +function run() { + $r = q("ALTER TABLE `item` ADD `diaspora_meta` MEDIUMTEXT NOT NULL DEFAULT '' AFTER `sig` "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1129.php b/Zotlabs/Update/_1129.php new file mode 100644 index 000000000..76bd155ee --- /dev/null +++ b/Zotlabs/Update/_1129.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1129 { +function run() { + $r = q("update hubloc set hubloc_network = 'zot' where hubloc_network = ''"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1130.php b/Zotlabs/Update/_1130.php new file mode 100644 index 000000000..1322a0b13 --- /dev/null +++ b/Zotlabs/Update/_1130.php @@ -0,0 +1,28 @@ +<?php + +namespace Zotlabs\Update; + +class _1130 { +function run() { + $myperms = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK + |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT + |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE; + + $r = q("select abook_channel, abook_my_perms from abook where (abook_flags & %d) and abook_my_perms != 0", + intval(ABOOK_FLAG_SELF) + ); + if($r) { + foreach($r as $rr) { + set_pconfig($rr['abook_channel'],'system','autoperms',$rr['abook_my_perms']); + } + } + $r = q("update abook set abook_my_perms = %d where (abook_flags & %d) and abook_my_perms = 0", + intval($myperms), + intval(ABOOK_FLAG_SELF) + ); + + return UPDATE_SUCCESS; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1131.php b/Zotlabs/Update/_1131.php new file mode 100644 index 000000000..72e968f67 --- /dev/null +++ b/Zotlabs/Update/_1131.php @@ -0,0 +1,20 @@ +<?php + +namespace Zotlabs\Update; + +class _1131 { +function run() { + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) // make sure this gets skipped for anyone who hasn't run it yet, it will fail on pg + return UPDATE_SUCCESS; + + $r1 = q("ALTER TABLE `abook` ADD `abook_rating_text` TEXT NOT NULL DEFAULT '' AFTER `abook_rating` "); + $r2 = q("ALTER TABLE `xlink` ADD `xlink_rating_text` TEXT NOT NULL DEFAULT '' AFTER `xlink_rating` "); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1132.php b/Zotlabs/Update/_1132.php new file mode 100644 index 000000000..9e085a351 --- /dev/null +++ b/Zotlabs/Update/_1132.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1132 { +function run() { + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { // correct previous failed update + $r1 = q("ALTER TABLE abook ADD abook_rating_text TEXT NOT NULL DEFAULT '' "); + $r2 = q("ALTER TABLE xlink ADD xlink_rating_text TEXT NOT NULL DEFAULT '' "); + if(!$r1 || !$r2) + return UPDATE_FAILED; + } + return UPDATE_SUCCESS; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1133.php b/Zotlabs/Update/_1133.php new file mode 100644 index 000000000..3820ef1ee --- /dev/null +++ b/Zotlabs/Update/_1133.php @@ -0,0 +1,38 @@ +<?php + +namespace Zotlabs\Update; + +class _1133 { +function run() { + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("CREATE TABLE xperm ( + xp_id serial NOT NULL, + xp_client varchar( 20 ) NOT NULL DEFAULT '', + xp_channel bigint NOT NULL DEFAULT '0', + xp_perm varchar( 64 ) NOT NULL DEFAULT '', + PRIMARY KEY (xp_id) )"); + $r2 = 0; + foreach(array('xp_client', 'xp_channel', 'xp_perm') as $fld) + $r2 += ((q("create index $fld on xperm ($fld)") == false) ? 0 : 1); + + $r = (($r1 && $r2) ? true : false); + } + else { + $r = q("CREATE TABLE IF NOT EXISTS `xperm` ( + `xp_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , + `xp_client` VARCHAR( 20 ) NOT NULL DEFAULT '', + `xp_channel` INT UNSIGNED NOT NULL DEFAULT '0', + `xp_perm` VARCHAR( 64 ) NOT NULL DEFAULT '', + KEY `xp_client` (`xp_client`), + KEY `xp_channel` (`xp_channel`), + KEY `xp_perm` (`xp_perm`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + } + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1134.php b/Zotlabs/Update/_1134.php new file mode 100644 index 000000000..d52bab044 --- /dev/null +++ b/Zotlabs/Update/_1134.php @@ -0,0 +1,20 @@ +<?php + +namespace Zotlabs\Update; + +class _1134 { +function run() { + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE xlink ADD xlink_static numeric(1) NOT NULL DEFAULT '0' "); + $r2 = q("create index xlink_static on xlink ( xlink_static ) "); + $r = $r1 && $r2; + } + else + $r = q("ALTER TABLE xlink ADD xlink_static TINYINT( 1 ) NOT NULL DEFAULT '0', ADD INDEX ( xlink_static ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1135.php b/Zotlabs/Update/_1135.php new file mode 100644 index 000000000..92a3e04b6 --- /dev/null +++ b/Zotlabs/Update/_1135.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1135 { +function run() { + $r = q("ALTER TABLE xlink ADD xlink_sig TEXT NOT NULL DEFAULT ''"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1136.php b/Zotlabs/Update/_1136.php new file mode 100644 index 000000000..0c1691fcb --- /dev/null +++ b/Zotlabs/Update/_1136.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1136 { +function run() { + $r1 = q("alter table item add item_unseen smallint not null default '0' "); + $r2 = q("create index item_unseen on item ( item_unseen ) "); + $r3 = q("update item set item_unseen = 1 where ( item_flags & 2 ) > 0 "); + + if($r1 && $r2 && $r3) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1137.php b/Zotlabs/Update/_1137.php new file mode 100644 index 000000000..ab11fe3db --- /dev/null +++ b/Zotlabs/Update/_1137.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1137 { +function run() { + $r1 = q("alter table site add site_valid smallint not null default '0' "); + $r2 = q("create index site_valid on site ( site_valid ) "); + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1138.php b/Zotlabs/Update/_1138.php new file mode 100644 index 000000000..b2eac12af --- /dev/null +++ b/Zotlabs/Update/_1138.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1138 { +function run() { + $r1 = q("alter table outq add outq_priority smallint not null default '0' "); + $r2 = q("create index outq_priority on outq ( outq_priority ) "); + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1139.php b/Zotlabs/Update/_1139.php new file mode 100644 index 000000000..aa4863fc1 --- /dev/null +++ b/Zotlabs/Update/_1139.php @@ -0,0 +1,21 @@ +<?php + +namespace Zotlabs\Update; + +class _1139 { +function run() { + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE channel ADD channel_lastpost timestamp NOT NULL DEFAULT '0001-01-01 00:00:00'"); + $r2 = q("create index channel_lastpost on channel ( channel_lastpost ) "); + $r = $r1 && $r2; + } + else + $r = q("ALTER TABLE `channel` ADD `channel_lastpost` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `channel_dirdate` , ADD INDEX ( `channel_lastpost` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1140.php b/Zotlabs/Update/_1140.php new file mode 100644 index 000000000..5b4c8f801 --- /dev/null +++ b/Zotlabs/Update/_1140.php @@ -0,0 +1,27 @@ +<?php + +namespace Zotlabs\Update; + +class _1140 { +function run() { + $r = q("select * from clients where true"); + $x = false; + if($r) { + foreach($r as $rr) { + $m = q("INSERT INTO xperm (xp_client, xp_channel, xp_perm) VALUES ('%s', %d, '%s') ", + dbesc($rr['client_id']), + intval($rr['uid']), + dbesc('all') + ); + if(! $m) + $x = true; + } + } + if($x) + return UPDATE_FAILED; + return UPDATE_SUCCESS; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1141.php b/Zotlabs/Update/_1141.php new file mode 100644 index 000000000..e1f84f469 --- /dev/null +++ b/Zotlabs/Update/_1141.php @@ -0,0 +1,30 @@ +<?php + +namespace Zotlabs\Update; + +class _1141 { +function run() { + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE menu ADD menu_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', ADD menu_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00'"); + $r2 = q("create index menu_created on menu ( menu_created ) "); + $r3 = q("create index menu_edited on menu ( menu_edited ) "); + $r = $r1 && $r2; + } + else + $r = q("ALTER TABLE menu ADD menu_created DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD menu_edited DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( menu_created ), ADD INDEX ( menu_edited ) "); + + $t = datetime_convert(); + q("update menu set menu_created = '%s', menu_edited = '%s' where true", + dbesc($t), + dbesc($t) + ); + + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1142.php b/Zotlabs/Update/_1142.php new file mode 100644 index 000000000..a8ffcc182 --- /dev/null +++ b/Zotlabs/Update/_1142.php @@ -0,0 +1,18 @@ +<?php + +namespace Zotlabs\Update; + +class _1142 { +function run() { + + $r1 = q("alter table site add site_dead smallint not null default '0' "); + $r2 = q("create index site_dead on site ( site_dead ) "); + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1143.php b/Zotlabs/Update/_1143.php new file mode 100644 index 000000000..99f23af61 --- /dev/null +++ b/Zotlabs/Update/_1143.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1143 { +function run() { + + $r1 = q("ALTER TABLE abook ADD abook_incl TEXT NOT NULL DEFAULT ''"); + $r2 = q("ALTER TABLE abook ADD abook_excl TEXT NOT NULL DEFAULT '' "); + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1144.php b/Zotlabs/Update/_1144.php new file mode 100644 index 000000000..848897de7 --- /dev/null +++ b/Zotlabs/Update/_1144.php @@ -0,0 +1,27 @@ +<?php + +namespace Zotlabs\Update; + +class _1144 { +function run() { + $r = q("select flags, id from attach where flags != 0"); + if($r) { + foreach($r as $rr) { + if($rr['flags'] & 1) { + q("update attach set is_dir = 1 where id = %d", + intval($rr['id']) + ); + } + if($rr['flags'] & 2) { + q("update attach set os_storage = 1 where id = %d", + intval($rr['id']) + ); + } + } + } + + return UPDATE_SUCCESS; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1145.php b/Zotlabs/Update/_1145.php new file mode 100644 index 000000000..5102acc8a --- /dev/null +++ b/Zotlabs/Update/_1145.php @@ -0,0 +1,30 @@ +<?php + +namespace Zotlabs\Update; + +class _1145 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE event ADD event_status char(255) NOT NULL DEFAULT '', + ADD event_status_date timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + ADD event_percent SMALLINT NOT NULL DEFAULT '0', + ADD event_repeat TEXT NOT NULL DEFAULT '' "); + $r2 = q("create index event_status on event ( event_status )"); + $r = $r1 && $r2; + } + else { + $r = q("ALTER TABLE `event` ADD `event_status` CHAR( 255 ) NOT NULL DEFAULT '', + ADD `event_status_date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', + ADD `event_percent` SMALLINT NOT NULL DEFAULT '0', + ADD `event_repeat` TEXT NOT NULL DEFAULT '', + ADD INDEX ( `event_status` ) "); + } + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1146.php b/Zotlabs/Update/_1146.php new file mode 100644 index 000000000..92a26adaf --- /dev/null +++ b/Zotlabs/Update/_1146.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1146 { +function run() { + + $r1 = q("alter table event add event_sequence smallint not null default '0' "); + $r2 = q("create index event_sequence on event ( event_sequence ) "); + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1147.php b/Zotlabs/Update/_1147.php new file mode 100644 index 000000000..b8f6716f7 --- /dev/null +++ b/Zotlabs/Update/_1147.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1147 { +function run() { + + $r1 = q("alter table event add event_priority smallint not null default '0' "); + $r2 = q("create index event_priority on event ( event_priority ) "); + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1148.php b/Zotlabs/Update/_1148.php new file mode 100644 index 000000000..ed9a4d93a --- /dev/null +++ b/Zotlabs/Update/_1148.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1148 { +function run() { + $r1 = q("alter table likes add i_mid char(255) not null default '' "); + $r2 = q("create index i_mid on likes ( i_mid ) "); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1149.php b/Zotlabs/Update/_1149.php new file mode 100644 index 000000000..f45bd995b --- /dev/null +++ b/Zotlabs/Update/_1149.php @@ -0,0 +1,35 @@ +<?php + +namespace Zotlabs\Update; + +class _1149 { +function run() { + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE obj ADD obj_term CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_url CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_imgurl CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + ADD obj_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' "); + } + else { + $r1 = q("ALTER TABLE obj ADD obj_term CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_url CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_imgurl CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_created DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', + ADD obj_edited DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' "); + } + + $r2 = q("create index obj_term on obj ( obj_term ) "); + $r3 = q("create index obj_url on obj ( obj_url ) "); + $r4 = q("create index obj_imgurl on obj ( obj_imgurl ) "); + $r5 = q("create index obj_created on obj ( obj_created ) "); + $r6 = q("create index obj_edited on obj ( obj_edited ) "); + $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6; + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1150.php b/Zotlabs/Update/_1150.php new file mode 100644 index 000000000..896fc75e3 --- /dev/null +++ b/Zotlabs/Update/_1150.php @@ -0,0 +1,28 @@ +<?php + +namespace Zotlabs\Update; + +class _1150 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE app ADD app_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + ADD app_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' "); + } + else { + $r1 = q("ALTER TABLE app ADD app_created DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', + ADD app_edited DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' "); + } + + $r2 = q("create index app_created on app ( app_created ) "); + $r3 = q("create index app_edited on app ( app_edited ) "); + + $r = $r1 && $r2 && $r3; + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1151.php b/Zotlabs/Update/_1151.php new file mode 100644 index 000000000..d14baabb1 --- /dev/null +++ b/Zotlabs/Update/_1151.php @@ -0,0 +1,24 @@ +<?php + +namespace Zotlabs\Update; + +class _1151 { +function run() { + + $r3 = q("select likes.*, item.mid from likes left join item on likes.iid = item.id"); + if($r3) { + foreach($r3 as $rr) { + q("update likes set i_mid = '%s' where id = $d", + dbesc($rr['mid']), + intval($rr['id']) + ); + } + } + + + return UPDATE_SUCCESS; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1152.php b/Zotlabs/Update/_1152.php new file mode 100644 index 000000000..54393d590 --- /dev/null +++ b/Zotlabs/Update/_1152.php @@ -0,0 +1,57 @@ +<?php + +namespace Zotlabs\Update; + +class _1152 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + + $r1 = q("CREATE TABLE IF NOT EXISTS \"dreport\" ( + \"dreport_id\" serial NOT NULL, + \"dreport_channel\" int(11) NOT NULL DEFAULT '0', + \"dreport_mid\" char(255) NOT NULL DEFAULT '', + \"dreport_site\" char(255) NOT NULL DEFAULT '', + \"dreport_recip\" char(255) NOT NULL DEFAULT '', + \"dreport_result\" char(255) NOT NULL DEFAULT '', + \"dreport_time\" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + \"dreport_xchan\" char(255) NOT NULL DEFAULT '', + PRIMARY KEY (\"dreport_id\") "); + + $r2 = q("create index \"dreport_mid\" on dreport (\"dreport_mid\") "); + $r3 = q("create index \"dreport_site\" on dreport (\"dreport_site\") "); + $r4 = q("create index \"dreport_time\" on dreport (\"dreport_time\") "); + $r5 = q("create index \"dreport_xchan\" on dreport (\"dreport_xchan\") "); + $r6 = q("create index \"dreport_channel\" on dreport (\"dreport_channel\") "); + + $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6; + + } + else { + $r = q("CREATE TABLE IF NOT EXISTS `dreport` ( + `dreport_id` int(11) NOT NULL AUTO_INCREMENT, + `dreport_channel` int(11) NOT NULL DEFAULT '0', + `dreport_mid` char(255) NOT NULL DEFAULT '', + `dreport_site` char(255) NOT NULL DEFAULT '', + `dreport_recip` char(255) NOT NULL DEFAULT '', + `dreport_result` char(255) NOT NULL DEFAULT '', + `dreport_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `dreport_xchan` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`dreport_id`), + KEY `dreport_mid` (`dreport_mid`), + KEY `dreport_site` (`dreport_site`), + KEY `dreport_time` (`dreport_time`), + KEY `dreport_xchan` (`dreport_xchan`), + KEY `dreport_channel` (`dreport_channel`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + } + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1153.php b/Zotlabs/Update/_1153.php new file mode 100644 index 000000000..cf8d451b4 --- /dev/null +++ b/Zotlabs/Update/_1153.php @@ -0,0 +1,18 @@ +<?php + +namespace Zotlabs\Update; + +class _1153 { +function run() { + + $r1 = q("ALTER TABLE dreport ADD dreport_queue CHAR( 255 ) NOT NULL DEFAULT '' "); + $r2 = q("create index dreport_queue on dreport ( dreport_queue) "); + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1154.php b/Zotlabs/Update/_1154.php new file mode 100644 index 000000000..6e92f525d --- /dev/null +++ b/Zotlabs/Update/_1154.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1154 { +function run() { + + $r = q("ALTER TABLE event ADD event_vdata text NOT NULL "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1155.php b/Zotlabs/Update/_1155.php new file mode 100644 index 000000000..8f2553b3e --- /dev/null +++ b/Zotlabs/Update/_1155.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1155 { +function run() { + + $r1 = q("alter table site add site_type smallint not null default '0' "); + $r2 = q("create index site_type on site ( site_type ) "); + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1156.php b/Zotlabs/Update/_1156.php new file mode 100644 index 000000000..536a219d8 --- /dev/null +++ b/Zotlabs/Update/_1156.php @@ -0,0 +1,28 @@ +<?php + +namespace Zotlabs\Update; + +class _1156 { +function run() { + $r1 = q("ALTER TABLE mail ADD conv_guid CHAR( 255 ) NOT NULL DEFAULT '' "); + $r2 = q("create index conv_guid on mail ( conv_guid ) "); + + $r3 = q("select mail.id, mail.convid, conv.guid from mail left join conv on mail.convid = conv.id where true"); + if($r3) { + foreach($r3 as $rr) { + if($rr['convid']) { + q("update mail set conv_guid = '%s' where id = %d", + dbesc($rr['guid']), + intval($rr['id']) + ); + } + } + } + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1157.php b/Zotlabs/Update/_1157.php new file mode 100644 index 000000000..01f452f32 --- /dev/null +++ b/Zotlabs/Update/_1157.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1157 { +function run() { + $r1 = q("alter table site add site_project char(255) not null default '' "); + $r2 = q("create index site_project on site ( site_project ) "); + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1158.php b/Zotlabs/Update/_1158.php new file mode 100644 index 000000000..89ac3daa1 --- /dev/null +++ b/Zotlabs/Update/_1158.php @@ -0,0 +1,22 @@ +<?php + +namespace Zotlabs\Update; + +class _1158 { +function run() { + $r = q("select attach.id, attach.data, channel_address from attach left join channel on attach.uid = channel_id where os_storage = 1 and not attach.data like '%%store%%' "); + if($r) { + foreach($r as $rr) { + $has_slash = ((substr($rr['data'],0,1) === '/') ? true : false); + q("update attach set data = '%s' where id = %d", + dbesc('store/' . $rr['channel_address']. (($has_slash) ? '' : '/' . $rr['data'])), + dbesc($rr['id']) + ); + } + } + return UPDATE_SUCCESS; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1159.php b/Zotlabs/Update/_1159.php new file mode 100644 index 000000000..1445092ad --- /dev/null +++ b/Zotlabs/Update/_1159.php @@ -0,0 +1,25 @@ +<?php + +namespace Zotlabs\Update; + +class _1159 { +function run() { + $r = q("select attach.id, attach.data, attach.hash, channel_address from attach left join channel on attach.uid = channel_id where os_storage = 1 "); + if($r) { + foreach($r as $rr) { + $x = dbunescbin($rr['data']); + $has_slash = (($x === 'store/' . $rr['channel_address'] . '/') ? true : false); + if(($x === 'store/' . $rr['channel_address']) || ($has_slash)) { + q("update attach set data = '%s' where id = %d", + dbesc('store/' . $rr['channel_address']. (($has_slash) ? '' : '/' . $rr['hash'])), + dbesc($rr['id']) + ); + } + } + } + return UPDATE_SUCCESS; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1160.php b/Zotlabs/Update/_1160.php new file mode 100644 index 000000000..b7b67076f --- /dev/null +++ b/Zotlabs/Update/_1160.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1160 { +function run() { + $r = q("alter table abook add abook_instance text not null default '' "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1161.php b/Zotlabs/Update/_1161.php new file mode 100644 index 000000000..870eb7ed6 --- /dev/null +++ b/Zotlabs/Update/_1161.php @@ -0,0 +1,43 @@ +<?php + +namespace Zotlabs\Update; + +class _1161 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("CREATE TABLE \"iconfig\" ( + \"id\" serial NOT NULL, + \"iid\" bigint NOT NULL DEFAULT '0', + \"cat\" text NOT NULL DEFAULT '', + \"k\" text NOT NULL DEFAULT '', + \"v\" text NOT NULL DEFAULT '', + PRIMARY_KEY(\"id\") +) "); +$r2 = q("create index \"iconfig_iid\" on iconfig (\"iid\") ");; +$r3 = q("create index \"iconfig_cat\" on iconfig (\"cat\") "); +$r4 = q("create index \"iconfig_k\" on iconfig (\"k\") "); + $r = $r1 && $r2 && $r3 && $r4; + } + else { + $r = q("CREATE TABLE IF NOT EXISTS `iconfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `iid` int(11) NOT NULL DEFAULT '0', + `cat` char(255) NOT NULL DEFAULT '', + `k` char(255) NOT NULL DEFAULT '', + `v` mediumtext NOT NULL, + PRIMARY KEY (`id`), + KEY `iid` (`iid`), + KEY `cat` (`cat`), + KEY `k` (`k`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + } + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1162.php b/Zotlabs/Update/_1162.php new file mode 100644 index 000000000..683ea9802 --- /dev/null +++ b/Zotlabs/Update/_1162.php @@ -0,0 +1,19 @@ +<?php + +namespace Zotlabs\Update; + +class _1162 { +function run() { + $r1 = q("alter table iconfig add sharing int not null default '0' "); + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) + $r2 = q("create index \"iconfig_sharing\" on iconfig (\"sharing\") "); + else + $r2 = q("alter table iconfig add index ( sharing ) "); + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1163.php b/Zotlabs/Update/_1163.php new file mode 100644 index 000000000..376447aea --- /dev/null +++ b/Zotlabs/Update/_1163.php @@ -0,0 +1,22 @@ +<?php + +namespace Zotlabs\Update; + +class _1163 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("alter table channel add channel_moved text not null default '' "); + $r2 = q("create index \"channel_channel_moved\" on channel (\"channel_moved\") "); + } + else { + $r1 = q("alter table channel add channel_moved char(255) not null default '' "); + $r2 = q("alter table channel add index ( channel_moved ) "); + } + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1164.php b/Zotlabs/Update/_1164.php new file mode 100644 index 000000000..bad9193d1 --- /dev/null +++ b/Zotlabs/Update/_1164.php @@ -0,0 +1,45 @@ +<?php + +namespace Zotlabs\Update; + +class _1164 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("CREATE TABLE \"abconfig\" ( + \"id\" serial NOT NULL, + \"chan\" text NOT NULL, + \"xchan\" text NOT NULL, + \"cat\" text NOT NULL, + \"k\" text NOT NULL, + \"v\" text NOT NULL, + PRIMARY KEY (\"id\") "); + $r2 = q("create index \"abconfig_chan\" on abconfig (\"chan\") "); + $r3 = q("create index \"abconfig_xchan\" on abconfig (\"xchan\") "); + $r4 = q("create index \"abconfig_cat\" on abconfig (\"cat\") "); + $r5 = q("create index \"abconfig_k\" on abconfig (\"k\") "); + $r = $r1 && $r2 && $r3 && $r4 && $r5; + } + else { + $r = q("CREATE TABLE IF NOT EXISTS `abconfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `chan` char(255) NOT NULL DEFAULT '', + `xchan` char(255) NOT NULL DEFAULT '', + `cat` char(255) NOT NULL DEFAULT '', + `k` char(255) NOT NULL DEFAULT '', + `v` mediumtext NOT NULL, + PRIMARY KEY (`id`), + KEY `chan` (`chan`), + KEY `xchan` (`xchan`), + KEY `cat` (`cat`), + KEY `k` (`k`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + } + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1165.php b/Zotlabs/Update/_1165.php new file mode 100644 index 000000000..fcea38dc8 --- /dev/null +++ b/Zotlabs/Update/_1165.php @@ -0,0 +1,20 @@ +<?php + +namespace Zotlabs\Update; + +class _1165 { +function run() { + + $r1 = q("alter table hook add hook_version int not null default '0' "); + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) + $r2 = q("create index \"hook_version_idx\" on hook (\"hook_version\") "); + else + $r2 = q("alter table hook add index ( hook_version ) "); + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1166.php b/Zotlabs/Update/_1166.php new file mode 100644 index 000000000..e320d5bc0 --- /dev/null +++ b/Zotlabs/Update/_1166.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1166 { +function run() { + + $r = q("alter table source add src_tag text not null default '' "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1167.php b/Zotlabs/Update/_1167.php new file mode 100644 index 000000000..b5510a21f --- /dev/null +++ b/Zotlabs/Update/_1167.php @@ -0,0 +1,26 @@ +<?php + +namespace Zotlabs\Update; + +class _1167 { +function run() { + + $r1 = q("alter table app add app_deleted int not null default '0' "); + $r2 = q("alter table app add app_system int not null default '0' "); + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r3 = q("create index \"app_deleted_idx\" on app (\"app_deleted\") "); + $r4 = q("create index \"app_system_idx\" on app (\"app_system\") "); + } + else { + $r3 = q("alter table app add index ( app_deleted ) "); + $r4 = q("alter table app add index ( app_system ) "); + } + + if($r1 && $r2 && $r3 && $r4) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1168.php b/Zotlabs/Update/_1168.php new file mode 100644 index 000000000..cf7d2689a --- /dev/null +++ b/Zotlabs/Update/_1168.php @@ -0,0 +1,23 @@ +<?php + +namespace Zotlabs\Update; + +class _1168 { +function run() { + + $r1 = q("alter table obj add obj_quantity int not null default '0' "); + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r2 = q("create index \"obj_quantity_idx\" on obj (\"obj_quantity\") "); + } + else { + $r2 = q("alter table obj add index ( obj_quantity ) "); + } + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1169.php b/Zotlabs/Update/_1169.php new file mode 100644 index 000000000..cfe4dbcd8 --- /dev/null +++ b/Zotlabs/Update/_1169.php @@ -0,0 +1,27 @@ +<?php + +namespace Zotlabs\Update; + +class _1169 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE `addon` CHANGE `timestamp` `tstamp` numeric( 20 ) UNSIGNED NOT NULL DEFAULT '0' "); + $r2 = q("ALTER TABLE `addon` CHANGE `name` `aname` text NOT NULL DEFAULT '' "); + $r3 = q("ALTER TABLE `hook` CHANGE `function` `fn` text NOT NULL DEFAULT '' "); + + } + else { + $r1 = q("ALTER TABLE `addon` CHANGE `timestamp` `tstamp` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0' "); + $r2 = q("ALTER TABLE `addon` CHANGE `name` `aname` CHAR(255) NOT NULL DEFAULT '' "); + $r3 = q("ALTER TABLE `hook` CHANGE `function` `fn` CHAR(255) NOT NULL DEFAULT '' "); + } + + if($r1 && $r2 && $r3) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1170.php b/Zotlabs/Update/_1170.php new file mode 100644 index 000000000..215aeebc7 --- /dev/null +++ b/Zotlabs/Update/_1170.php @@ -0,0 +1,21 @@ +<?php + +namespace Zotlabs\Update; + +class _1170 { +function run() { + + $r1 = q("drop table fcontact"); + $r2 = q("drop table ffinder"); + $r3 = q("drop table fserver"); + $r4 = q("drop table fsuggest"); + $r5 = q("drop table spam"); + + if($r1 && $r2 && $r3 && $r4 && $r5) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1171.php b/Zotlabs/Update/_1171.php new file mode 100644 index 000000000..5cbf0ca21 --- /dev/null +++ b/Zotlabs/Update/_1171.php @@ -0,0 +1,24 @@ +<?php + +namespace Zotlabs\Update; + +class _1171 { +function run() { + + $r1 = q("ALTER TABLE verify CHANGE `type` `vtype` varchar(32) NOT NULL DEFAULT '' "); + $r2 = q("ALTER TABLE tokens CHANGE `scope` `auth_scope` varchar(512) NOT NULL DEFAULT '' "); + $r3 = q("ALTER TABLE auth_codes CHANGE `scope` `auth_scope` varchar(512) NOT NULL DEFAULT '' "); + $r4 = q("ALTER TABLE clients CHANGE `name` `clname` TEXT "); + $r5 = q("ALTER TABLE session CHANGE `data` `sess_data` TEXT NOT NULL "); + $r6 = q("ALTER TABLE register CHANGE `language` `lang` varchar(16) NOT NULL DEFAULT '' "); + + if($r1 && $r2 && $r3 && $r4 && $r5 && $r6) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + + + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1172.php b/Zotlabs/Update/_1172.php new file mode 100644 index 000000000..117e87fa1 --- /dev/null +++ b/Zotlabs/Update/_1172.php @@ -0,0 +1,29 @@ +<?php + +namespace Zotlabs\Update; + +class _1172 { +function run() { + + $r1 = q("ALTER TABLE term CHANGE `type` `ttype` int(3) NOT NULL DEFAULT '0' "); + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r2 = q("ALTER TABLE groups CHANGE `name` `gname` TEXT NOT NULL "); + $r3 = q("ALTER TABLE profile CHANGE `name` `fullname` TEXT NOT NULL "); + $r4 = q("ALTER TABLE profile CHANGE `with` `partner` TEXT NOT NULL "); + $r5 = q("ALTER TABLE profile CHANGE `work` `employment` TEXT NOT NULL "); + } + else { + $r2 = q("ALTER TABLE groups CHANGE `name` `gname` char(255) NOT NULL DEFAULT '' "); + $r3 = q("ALTER TABLE profile CHANGE `name` `fullname` char(255) NOT NULL DEFAULT '' "); + $r4 = q("ALTER TABLE profile CHANGE `with` `partner` char(255) NOT NULL DEFAULT '' "); + $r5 = q("ALTER TABLE profile CHANGE `work` `employment` TEXT NOT NULL "); + } + if($r1 && $r2 && $r3 && $r4 && $r5) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1173.php b/Zotlabs/Update/_1173.php new file mode 100644 index 000000000..7c0d76c73 --- /dev/null +++ b/Zotlabs/Update/_1173.php @@ -0,0 +1,27 @@ +<?php + +namespace Zotlabs\Update; + +class _1173 { +function run() { + + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE notify CHANGE `name` `xname` TEXT NOT NULL "); + $r2 = q("ALTER TABLE notify CHANGE `date` `created` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' "); + $r3 = q("ALTER TABLE notify CHANGE `type` `ntype` numeric(3) NOT NULL DEFAULT '0' "); + } + else { + $r1 = q("ALTER TABLE notify CHANGE `name` `xname` char(255) NOT NULL DEFAULT '' "); + $r2 = q("ALTER TABLE notify CHANGE `date` `created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' "); + $r3 = q("ALTER TABLE notify CHANGE `type` `ntype` smallint(3) NOT NULL DEFAULT '0' "); + } + + if($r1 && $r2 && $r3) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1174.php b/Zotlabs/Update/_1174.php new file mode 100644 index 000000000..0d68b2d65 --- /dev/null +++ b/Zotlabs/Update/_1174.php @@ -0,0 +1,32 @@ +<?php + +namespace Zotlabs\Update; + +class _1174 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE event CHANGE `type` `etype` varchar(255) NOT NULL DEFAULT '' "); + $r2 = q("ALTER TABLE event CHANGE `start` `dtstart` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' "); + $r3 = q("ALTER TABLE event CHANGE `finish` `dtend` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' "); + $r4 = q("ALTER TABLE event CHANGE `ignore` `dismissed` numeric(1) NOT NULL DEFAULT '0' "); + $r5 = q("ALTER TABLE attach CHANGE `data` `content` bytea NOT NULL "); + $r6 = q("ALTER TABLE photo CHANGE `data` `content` bytea NOT NULL "); + } + else { + $r1 = q("ALTER TABLE event CHANGE `type` `etype` char(255) NOT NULL DEFAULT '' "); + $r2 = q("ALTER TABLE event CHANGE `start` `dtstart` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' "); + $r3 = q("ALTER TABLE event CHANGE `finish` `dtend` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' "); + $r4 = q("ALTER TABLE event CHANGE `ignore` `dismissed` tinyint(1) NOT NULL DEFAULT '0' "); + $r5 = q("ALTER TABLE attach CHANGE `data` `content` longblob NOT NULL "); + $r6 = q("ALTER TABLE photo CHANGE `data` `content` mediumblob NOT NULL "); + } + + if($r1 && $r2 && $r3 && $r4 && $r5 && $r6) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1175.php b/Zotlabs/Update/_1175.php new file mode 100644 index 000000000..188586084 --- /dev/null +++ b/Zotlabs/Update/_1175.php @@ -0,0 +1,31 @@ +<?php + +namespace Zotlabs\Update; + +class _1175 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE item CHANGE `object` `obj` text NOT NULL"); + $r2 = q("ALTER TABLE photo CHANGE `size` `filesize` bigint NOT NULL DEFAULT '0' "); + $r3 = q("ALTER TABLE photo CHANGE `scale` `imgscale` numeric(3) NOT NULL DEFAULT '0' "); + $r4 = q("ALTER TABLE photo CHANGE `type` `mimetype` varchar(128) NOT NULL DEFAULT 'image/jpeg' "); + + } + else { + $r1 = q("ALTER TABLE item CHANGE `object` `obj` text NOT NULL"); + $r2 = q("ALTER TABLE photo CHANGE `size` `filesize` int(10) unsigned NOT NULL DEFAULT '0' "); + $r3 = q("ALTER TABLE photo CHANGE `scale` `imgscale` tinyint(3) unsigned NOT NULL DEFAULT '0' "); + $r4 = q("ALTER TABLE photo CHANGE `type` `mimetype` char(128) NOT NULL DEFAULT 'image/jpeg' "); + + } + + if($r1 && $r2 && $r3 && $r4) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1176.php b/Zotlabs/Update/_1176.php new file mode 100644 index 000000000..8c02ee436 --- /dev/null +++ b/Zotlabs/Update/_1176.php @@ -0,0 +1,19 @@ +<?php + +namespace Zotlabs\Update; + +class _1176 { +function run() { + + $r = q("select * from item_id where true"); + if($r) { + foreach($r as $rr) { + \Zotlabs\Lib\IConfig::Set($rr['iid'],'system',$rr['service'],$rr['sid'],true); + } + } + return UPDATE_SUCCESS; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1177.php b/Zotlabs/Update/_1177.php new file mode 100644 index 000000000..119e48ee8 --- /dev/null +++ b/Zotlabs/Update/_1177.php @@ -0,0 +1,66 @@ +<?php + +namespace Zotlabs\Update; + +class _1177 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("alter table event add cal_id bigint NOT NULL DEFAULT '0'"); + $r2 = q("create index \"event_cal_idx\" on event (\"cal_id\") "); + + $r3 = q("CREATE TABLE \"cal\" ( + \"cal_id\" serial NOT NULL, + \"cal_aid\" bigint NOT NULL DEFAULT '0', + \"cal_uid\" bigint NOT NULL DEFAULT '0', + \"cal_hash\" text NOT NULL, + \"cal_name\" text NOT NULL, + \"uri\" text NOT NULL, + \"logname\" text NOT NULL, + \"pass\" text NOT NULL, + \"ctag\" text NOT NULL, + \"synctoken\" text NOT NULL, + \"cal_types\" text NOT NULL, + PRIMARY KEY (\"cal_id\") "); + $r4 = q("create index \"cal_hash_idx\" on cal (\"cal_hash\") "); + $r5 = q("create index \"cal_name_idx\" on cal (\"cal_name\") "); + $r6 = q("create index \"cal_types_idx\" on cal (\"cal_types\") "); + $r7 = q("create index \"cal_aid_idx\" on cal (\"cal_aid\") "); + $r8 = q("create index \"cal_uid_idx\" on cal (\"cal_uid\") "); + $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6 && $r7 && $r8; + } + else { + $r1 = q("alter table event add cal_id int(10) unsigned NOT NULL DEFAULT '0', + add index ( cal_id ) "); + + $r2 = q("CREATE TABLE IF NOT EXISTS `cal` ( + `cal_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `cal_aid` int(10) unsigned NOT NULL DEFAULT '0', + `cal_uid` int(10) unsigned NOT NULL DEFAULT '0', + `cal_hash` varchar(255) NOT NULL DEFAULT '', + `cal_name` varchar(255) NOT NULL DEFAULT '', + `uri` varchar(255) NOT NULL DEFAULT '', + `logname` varchar(255) NOT NULL DEFAULT '', + `pass` varchar(255) NOT NULL DEFAULT '', + `ctag` varchar(255) NOT NULL DEFAULT '', + `synctoken` varchar(255) NOT NULL DEFAULT '', + `cal_types` varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (`cal_id`), + KEY `cal_aid` (`cal_aid`), + KEY `cal_uid` (`cal_uid`), + KEY `cal_hash` (`cal_hash`), + KEY `cal_name` (`cal_name`), + KEY `cal_types` (`cal_types`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + $r = $r1 && $r2; + } + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1178.php b/Zotlabs/Update/_1178.php new file mode 100644 index 000000000..97c42a16d --- /dev/null +++ b/Zotlabs/Update/_1178.php @@ -0,0 +1,42 @@ +<?php + +namespace Zotlabs\Update; + +class _1178 { +function run() { + + $c2 = null; + + $c1 = q("SELECT channel_id, channel_hash from channel where true"); + if($c1) { + $c2 = q("SELECT id, chan from abconfig where true"); + if($c2) { + for($x = 0; $x < count($c2); $x ++) { + foreach($c1 as $c) { + if($c['channel_hash'] == $c2[$x]['chan']) { + $c2[$x]['chan'] = $c['channel_id']; + break; + } + } + } + } + } + + $r1 = q("ALTER TABLE abconfig CHANGE chan chan int(10) unsigned NOT NULL DEFAULT '0' "); + + if($c2) { + foreach($c2 as $c) { + q("UPDATE abconfig SET chan = %d where id = %d", + intval($c['chan']), + intval($c['id']) + ); + } + } + + if($r1) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1179.php b/Zotlabs/Update/_1179.php new file mode 100644 index 000000000..44227c8d3 --- /dev/null +++ b/Zotlabs/Update/_1179.php @@ -0,0 +1,49 @@ +<?php + +namespace Zotlabs\Update; + +class _1179 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("CREATE TABLE atoken ( + atoken_id serial NOT NULL, + atoken_aid bigint NOT NULL DEFAULT 0, + atoken_uid bigint NOT NULL DEFAULT 0, + atoken_name varchar(255) NOT NULL DEFAULT '', + atoken_token varchar(255) NOT NULL DEFAULT '', + atoken_expires timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + PRIMARY KEY (atoken_id)) "); + $r2 = q("create index atoken_aid on atoken (atoken_aid)"); + $r3 = q("create index atoken_uid on atoken (atoken_uid)"); + $r4 = q("create index atoken_name on atoken (atoken_name)"); + $r5 = q("create index atoken_token on atoken (atoken_token)"); + $r6 = q("create index atoken_expires on atoken (atoken_expires)"); + + $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6; + + } + else { + $r = q("CREATE TABLE IF NOT EXISTS `atoken` ( + `atoken_id` int(11) NOT NULL AUTO_INCREMENT, + `atoken_aid` int(11) NOT NULL DEFAULT 0, + `atoken_uid` int(11) NOT NULL DEFAULT 0, + `atoken_name` char(255) NOT NULL DEFAULT '', + `atoken_token` char(255) NOT NULL DEFAULT '', + `atoken_expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + PRIMARY KEY (`atoken_id`), + KEY `atoken_aid` (`atoken_aid`), + KEY `atoken_uid` (`atoken_uid`), + KEY `atoken_name` (`atoken_name`), + KEY `atoken_token` (`atoken_token`), + KEY `atoken_expires` (`atoken_expires`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + } + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1180.php b/Zotlabs/Update/_1180.php new file mode 100644 index 000000000..f02f46231 --- /dev/null +++ b/Zotlabs/Update/_1180.php @@ -0,0 +1,32 @@ +<?php + +namespace Zotlabs\Update; + +class _1180 { +function run() { + + require_once('include/perm_upgrade.php'); + + $r1 = q("select * from channel where true"); + if($r1) { + foreach($r1 as $rr) { + perm_limits_upgrade($rr); + autoperms_upgrade($rr); + } + } + + $r2 = q("select * from abook where true"); + if($r2) { + foreach($r2 as $rr) { + perm_abook_upgrade($rr); + } + } + + $r = $r1 && $r2; + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1181.php b/Zotlabs/Update/_1181.php new file mode 100644 index 000000000..fc2d94b6b --- /dev/null +++ b/Zotlabs/Update/_1181.php @@ -0,0 +1,14 @@ +<?php + +namespace Zotlabs\Update; + +class _1181 { +function run() { + if(\Zotlabs\Lib\System::get_server_role() == 'pro') { + q("update account set account_level = 5 where true"); + } + return UPDATE_SUCCESS; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1182.php b/Zotlabs/Update/_1182.php new file mode 100644 index 000000000..d652f432e --- /dev/null +++ b/Zotlabs/Update/_1182.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1182 { +function run() { + + $r1 = q("alter table site add site_version varchar(32) not null default '' "); + + if($r1) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1183.php b/Zotlabs/Update/_1183.php new file mode 100644 index 000000000..6e9f89271 --- /dev/null +++ b/Zotlabs/Update/_1183.php @@ -0,0 +1,25 @@ +<?php + +namespace Zotlabs\Update; + +class _1183 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("alter table hook ALTER COLUMN priority TYPE smallint"); + $r2 = q("alter table hook ALTER COLUMN priority SET NOT NULL"); + $r3 = q("alter table hook ALTER COLUMN priority SET DEFAULT '0'"); + $r1 = $r1 && $r2 && $r3; + } + else { + $r1 = q("alter table hook CHANGE priority priority smallint NOT NULL DEFAULT '0' "); + } + $r2 = q("create index priority_idx on hook (priority)"); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1184.php b/Zotlabs/Update/_1184.php new file mode 100644 index 000000000..e8c37888c --- /dev/null +++ b/Zotlabs/Update/_1184.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1184 { +function run() { + + $r1 = q("alter table site add site_crypto text not null default '' "); + + if($r1) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1185.php b/Zotlabs/Update/_1185.php new file mode 100644 index 000000000..c7f4f1bd4 --- /dev/null +++ b/Zotlabs/Update/_1185.php @@ -0,0 +1,16 @@ +<?php + +namespace Zotlabs\Update; + +class _1185 { +function run() { + + $r1 = q("alter table app add app_plugin text not null default '' "); + + if($r1) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1186.php b/Zotlabs/Update/_1186.php new file mode 100644 index 000000000..a9c4f0e36 --- /dev/null +++ b/Zotlabs/Update/_1186.php @@ -0,0 +1,18 @@ +<?php + +namespace Zotlabs\Update; + +class _1186 { +function run() { + + $r1 = q("alter table profile add profile_vcard text not null"); + + if($r1) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1187.php b/Zotlabs/Update/_1187.php new file mode 100644 index 000000000..0fce5aa05 --- /dev/null +++ b/Zotlabs/Update/_1187.php @@ -0,0 +1,24 @@ +<?php + +namespace Zotlabs\Update; + +class _1187 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("alter table outq add outq_scheduled timestamp not null default '0001-01-01 00:00:00' "); + } + else { + $r1 = q("alter table outq add outq_scheduled datetime not null default '0001-01-01 00:00:00' "); + } + $r2 = q("create index outq_scheduled_idx on outq (outq_scheduled)"); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1188.php b/Zotlabs/Update/_1188.php new file mode 100644 index 000000000..eb0335aab --- /dev/null +++ b/Zotlabs/Update/_1188.php @@ -0,0 +1,18 @@ +<?php + +namespace Zotlabs\Update; + +class _1188 { +function run() { + + $r1 = q("alter table channel add channel_password varchar(255) not null default '' "); + $r2 = q("alter table channel add channel_salt varchar(255) not null default '' "); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1189.php b/Zotlabs/Update/_1189.php new file mode 100644 index 000000000..5cd180fbd --- /dev/null +++ b/Zotlabs/Update/_1189.php @@ -0,0 +1,23 @@ +<?php + +namespace Zotlabs\Update; + +class _1189 { +function run() { + + $r1 = q("alter table mail add mail_mimetype varchar(64) not null default 'text/bbcode' "); + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r2 = q("alter table mail add mail_raw smallint not null default 0 "); + } + else { + $r2 = q("alter table mail add mail_raw tinyint(4) not null default 0 "); + } + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1190.php b/Zotlabs/Update/_1190.php new file mode 100644 index 000000000..9321b82b8 --- /dev/null +++ b/Zotlabs/Update/_1190.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1190 { +function run() { + $r1 = q("alter table abook add abook_not_here smallint not null default 0 "); + + $r2 = q("create index abook_not_here on abook (abook_not_here)"); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1191.php b/Zotlabs/Update/_1191.php new file mode 100644 index 000000000..015b9a2ca --- /dev/null +++ b/Zotlabs/Update/_1191.php @@ -0,0 +1,425 @@ +<?php + +namespace Zotlabs\Update; + +class _1191 { +function run() { + + $r = q("SELECT 1 FROM principals LIMIT 1"); + + if($r !== false) { + return UPDATE_SUCCESS; + } + else { + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("CREATE TABLE addressbooks ( + id SERIAL NOT NULL, + principaluri VARCHAR(255), + displayname VARCHAR(255), + uri VARCHAR(200), + description TEXT, + synctoken INTEGER NOT NULL DEFAULT 1 + );" + ); + + $r2 = q("ALTER TABLE ONLY addressbooks ADD CONSTRAINT addressbooks_pkey PRIMARY KEY (id);"); + + $r3 = q("CREATE UNIQUE INDEX addressbooks_ukey ON addressbooks USING btree (principaluri, uri);"); + + $r4 = q("CREATE TABLE cards ( + id SERIAL NOT NULL, + addressbookid INTEGER NOT NULL, + carddata BYTEA, + uri VARCHAR(200), + lastmodified INTEGER, + etag VARCHAR(32), + size INTEGER NOT NULL + );" + ); + + $r5 = q("ALTER TABLE ONLY cards ADD CONSTRAINT cards_pkey PRIMARY KEY (id);"); + + $r6 = q("CREATE UNIQUE INDEX cards_ukey ON cards USING btree (addressbookid, uri);"); + + $r7 = q("CREATE TABLE addressbookchanges ( + id SERIAL NOT NULL, + uri VARCHAR(200) NOT NULL, + synctoken INTEGER NOT NULL, + addressbookid INTEGER NOT NULL, + operation SMALLINT NOT NULL + );" + ); + + $r8 = q("ALTER TABLE ONLY addressbookchanges ADD CONSTRAINT addressbookchanges_pkey PRIMARY KEY (id);"); + + $r9 = q("CREATE INDEX addressbookchanges_addressbookid_synctoken_ix ON addressbookchanges USING btree (addressbookid, synctoken);"); + + $r10 = q("CREATE TABLE calendarobjects ( + id SERIAL NOT NULL, + calendardata BYTEA, + uri VARCHAR(200), + calendarid INTEGER NOT NULL, + lastmodified INTEGER, + etag VARCHAR(32), + size INTEGER NOT NULL, + componenttype VARCHAR(8), + firstoccurence INTEGER, + lastoccurence INTEGER, + uid VARCHAR(200) + );" + ); + + $r11 = q("ALTER TABLE ONLY calendarobjects ADD CONSTRAINT calendarobjects_pkey PRIMARY KEY (id);"); + + $r12 = q("CREATE UNIQUE INDEX calendarobjects_ukey ON calendarobjects USING btree (calendarid, uri);"); + + $r13 = q("CREATE TABLE calendars ( + id SERIAL NOT NULL, + synctoken INTEGER NOT NULL DEFAULT 1, + components VARCHAR(21) + );" + ); + + $r14 = q("ALTER TABLE ONLY calendars ADD CONSTRAINT calendars_pkey PRIMARY KEY (id);"); + + $r15 = q("CREATE TABLE calendarinstances ( + id SERIAL NOT NULL, + calendarid INTEGER NOT NULL, + principaluri VARCHAR(100), + access SMALLINT NOT NULL DEFAULT '1', -- '1 = owner, 2 = read, 3 = readwrite' + displayname VARCHAR(100), + uri VARCHAR(200), + description TEXT, + calendarorder INTEGER NOT NULL DEFAULT 0, + calendarcolor VARCHAR(10), + timezone TEXT, + transparent SMALLINT NOT NULL DEFAULT '0', + share_href VARCHAR(100), + share_displayname VARCHAR(100), + share_invitestatus SMALLINT NOT NULL DEFAULT '2' -- '1 = noresponse, 2 = accepted, 3 = declined, 4 = invalid' + );" + ); + + $r16 = q("ALTER TABLE ONLY calendarinstances ADD CONSTRAINT calendarinstances_pkey PRIMARY KEY (id);"); + + $r17 = q("CREATE UNIQUE INDEX calendarinstances_principaluri_uri ON calendarinstances USING btree (principaluri, uri);"); + + $r18 = q("CREATE UNIQUE INDEX calendarinstances_principaluri_calendarid ON calendarinstances USING btree (principaluri, calendarid);"); + + $r19 = q("CREATE UNIQUE INDEX calendarinstances_principaluri_share_href ON calendarinstances USING btree (principaluri, share_href);"); + + $r20 = q("CREATE TABLE calendarsubscriptions ( + id SERIAL NOT NULL, + uri VARCHAR(200) NOT NULL, + principaluri VARCHAR(100) NOT NULL, + source TEXT, + displayname VARCHAR(100), + refreshrate VARCHAR(10), + calendarorder INTEGER NOT NULL DEFAULT 0, + calendarcolor VARCHAR(10), + striptodos SMALLINT NULL, + stripalarms SMALLINT NULL, + stripattachments SMALLINT NULL, + lastmodified INTEGER + );" + ); + + $r21 = q("ALTER TABLE ONLY calendarsubscriptions ADD CONSTRAINT calendarsubscriptions_pkey PRIMARY KEY (id);"); + + $r22 = q("CREATE UNIQUE INDEX calendarsubscriptions_ukey ON calendarsubscriptions USING btree (principaluri, uri);"); + + $r23 = q("CREATE TABLE calendarchanges ( + id SERIAL NOT NULL, + uri VARCHAR(200) NOT NULL, + synctoken INTEGER NOT NULL, + calendarid INTEGER NOT NULL, + operation SMALLINT NOT NULL DEFAULT 0 + );" + ); + + $r24 = q("ALTER TABLE ONLY calendarchanges ADD CONSTRAINT calendarchanges_pkey PRIMARY KEY (id);"); + + $r25 = q("CREATE INDEX calendarchanges_calendarid_synctoken_ix ON calendarchanges USING btree (calendarid, synctoken);"); + + $r26 = q("CREATE TABLE schedulingobjects ( + id SERIAL NOT NULL, + principaluri VARCHAR(255), + calendardata BYTEA, + uri VARCHAR(200), + lastmodified INTEGER, + etag VARCHAR(32), + size INTEGER NOT NULL + );" + ); + + $r27 = q("CREATE TABLE locks ( + id SERIAL NOT NULL, + owner VARCHAR(100), + timeout INTEGER, + created INTEGER, + token VARCHAR(100), + scope SMALLINT, + depth SMALLINT, + uri TEXT + );" + ); + + $r28 = q("ALTER TABLE ONLY locks ADD CONSTRAINT locks_pkey PRIMARY KEY (id);"); + + $r29 = q("CREATE INDEX locks_token_ix ON locks USING btree (token);"); + + $r30 = q("CREATE INDEX locks_uri_ix ON locks USING btree (uri);"); + + $r31 = q("CREATE TABLE principals ( + id SERIAL NOT NULL, + uri VARCHAR(200) NOT NULL, + email VARCHAR(80), + displayname VARCHAR(80) + );" + ); + + $r32 = q("ALTER TABLE ONLY principals ADD CONSTRAINT principals_pkey PRIMARY KEY (id);"); + + $r33 = q("CREATE UNIQUE INDEX principals_ukey ON principals USING btree (uri);"); + + $r34 = q("CREATE TABLE groupmembers ( + id SERIAL NOT NULL, + principal_id INTEGER NOT NULL, + member_id INTEGER NOT NULL + );" + ); + + $r35 = q("ALTER TABLE ONLY groupmembers ADD CONSTRAINT groupmembers_pkey PRIMARY KEY (id);"); + + $r36 = q("CREATE UNIQUE INDEX groupmembers_ukey ON groupmembers USING btree (principal_id, member_id);"); + + $r37 = q("CREATE TABLE propertystorage ( + id SERIAL NOT NULL, + path VARCHAR(1024) NOT NULL, + name VARCHAR(100) NOT NULL, + valuetype INT, + value BYTEA + );" + ); + + $r38 = q("ALTER TABLE ONLY propertystorage ADD CONSTRAINT propertystorage_pkey PRIMARY KEY (id);"); + + $r39 = q("CREATE UNIQUE INDEX propertystorage_ukey ON propertystorage (path, name);"); + + $r40 = q("CREATE TABLE users ( + id SERIAL NOT NULL, + username VARCHAR(50), + digesta1 VARCHAR(32) + );" + ); + + $r41 = q("ALTER TABLE ONLY users ADD CONSTRAINT users_pkey PRIMARY KEY (id);"); + + $r42 = q("CREATE UNIQUE INDEX users_ukey ON users USING btree (username);"); + + if( + $r1 && $r2 && $r3 && $r4 && $r5 && $r6 && $r7 && $r8 && $r9 && $r10 + && $r11 && $r12 && $r13 && $r14 && $r15 && $r16 && $r17 && $r18 && $r19 && $r20 + && $r21 && $r22 && $r23 && $r24 && $r25 && $r26 && $r27 && $r28 && $r29 && $r30 + && $r31 && $r32 && $r33 && $r34 && $r35 && $r36 && $r37 && $r38 && $r39 && $r40 + && $r41 && $r42 + ) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + } + else { + $r1 = q("CREATE TABLE if not exists addressbooks ( + id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + principaluri VARBINARY(255), + displayname VARCHAR(255), + uri VARBINARY(200), + description TEXT, + synctoken INT(11) UNSIGNED NOT NULL DEFAULT '1', + UNIQUE(principaluri(100), uri(100)) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" + ); + + $r2 = q("CREATE TABLE if not exists cards ( + id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + addressbookid INT(11) UNSIGNED NOT NULL, + carddata MEDIUMBLOB, + uri VARBINARY(200), + lastmodified INT(11) UNSIGNED, + etag VARBINARY(32), + size INT(11) UNSIGNED NOT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" + ); + + $r3 = q("CREATE TABLE if not exists addressbookchanges ( + id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + uri VARBINARY(200) NOT NULL, + synctoken INT(11) UNSIGNED NOT NULL, + addressbookid INT(11) UNSIGNED NOT NULL, + operation TINYINT(1) NOT NULL, + INDEX addressbookid_synctoken (addressbookid, synctoken) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" + ); + + $r4 = q("CREATE TABLE if not exists calendarobjects ( + id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + calendardata MEDIUMBLOB, + uri VARBINARY(200), + calendarid INTEGER UNSIGNED NOT NULL, + lastmodified INT(11) UNSIGNED, + etag VARBINARY(32), + size INT(11) UNSIGNED NOT NULL, + componenttype VARBINARY(8), + firstoccurence INT(11) UNSIGNED, + lastoccurence INT(11) UNSIGNED, + uid VARBINARY(200), + UNIQUE(calendarid, uri), + INDEX calendarid_time (calendarid, firstoccurence) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" + ); + + $r5 = q("CREATE TABLE if not exists calendars ( + id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + synctoken INTEGER UNSIGNED NOT NULL DEFAULT '1', + components VARBINARY(21) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" + ); + + $r6 = q("CREATE TABLE if not exists calendarinstances ( + id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + calendarid INTEGER UNSIGNED NOT NULL, + principaluri VARBINARY(100), + access TINYINT(1) NOT NULL DEFAULT '1' COMMENT '1 = owner, 2 = read, 3 = readwrite', + displayname VARCHAR(100), + uri VARBINARY(200), + description TEXT, + calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0', + calendarcolor VARBINARY(10), + timezone TEXT, + transparent TINYINT(1) NOT NULL DEFAULT '0', + share_href VARBINARY(100), + share_displayname VARCHAR(100), + share_invitestatus TINYINT(1) NOT NULL DEFAULT '2' COMMENT '1 = noresponse, 2 = accepted, 3 = declined, 4 = invalid', + UNIQUE(principaluri, uri), + UNIQUE(calendarid, principaluri), + UNIQUE(calendarid, share_href) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" + ); + + $r7 = q("CREATE TABLE if not exists calendarchanges ( + id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + uri VARBINARY(200) NOT NULL, + synctoken INT(11) UNSIGNED NOT NULL, + calendarid INT(11) UNSIGNED NOT NULL, + operation TINYINT(1) NOT NULL, + INDEX calendarid_synctoken (calendarid, synctoken) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" + ); + + $r8 = q("CREATE TABLE if not exists calendarsubscriptions ( + id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + uri VARBINARY(200) NOT NULL, + principaluri VARBINARY(100) NOT NULL, + source TEXT, + displayname VARCHAR(100), + refreshrate VARCHAR(10), + calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0', + calendarcolor VARBINARY(10), + striptodos TINYINT(1) NULL, + stripalarms TINYINT(1) NULL, + stripattachments TINYINT(1) NULL, + lastmodified INT(11) UNSIGNED, + UNIQUE(principaluri, uri) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" + ); + + $r9 = q("CREATE TABLE if not exists schedulingobjects ( + id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + principaluri VARBINARY(255), + calendardata MEDIUMBLOB, + uri VARBINARY(200), + lastmodified INT(11) UNSIGNED, + etag VARBINARY(32), + size INT(11) UNSIGNED NOT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" + ); + + $r10 = q("CREATE TABLE if not exists locks ( + id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + owner VARCHAR(100), + timeout INTEGER UNSIGNED, + created INTEGER, + token VARBINARY(100), + scope TINYINT, + depth TINYINT, + uri VARBINARY(1000), + INDEX(token), + INDEX(uri(100)) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" + ); + + $r11 = q("CREATE TABLE if not exists principals ( + id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + uri VARBINARY(200) NOT NULL, + email VARBINARY(80), + displayname VARCHAR(80), + UNIQUE(uri) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" + ); + + $r12 = q("CREATE TABLE if not exists groupmembers ( + id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + principal_id INTEGER UNSIGNED NOT NULL, + member_id INTEGER UNSIGNED NOT NULL, + UNIQUE(principal_id, member_id) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" + ); + + $r13 = q("CREATE TABLE if not exists propertystorage ( + id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + path VARBINARY(1024) NOT NULL, + name VARBINARY(100) NOT NULL, + valuetype INT UNSIGNED, + value MEDIUMBLOB + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" + ); + + $r14 = q("CREATE UNIQUE INDEX path_property ON propertystorage (path(600), name(100));"); + + $r15 = q("CREATE TABLE if not exists users ( + id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + username VARBINARY(50), + digesta1 VARBINARY(32), + UNIQUE(username) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" + ); + + $r16 = q("CREATE TABLE if not exists calendarinstances ( + id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + calendarid INTEGER UNSIGNED NOT NULL, + principaluri VARBINARY(100), + access TINYINT(1) NOT NULL DEFAULT '1' COMMENT '1 = owner, 2 = read, 3 = readwrite', + displayname VARCHAR(100), + uri VARBINARY(200), + description TEXT, + calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0', + calendarcolor VARBINARY(10), + timezone TEXT, + transparent TINYINT(1) NOT NULL DEFAULT '0', + share_href VARBINARY(100), + share_displayname VARCHAR(100), + share_invitestatus TINYINT(1) NOT NULL DEFAULT '2' COMMENT '1 = noresponse, 2 = accepted, 3 = declined, 4 = invalid', + UNIQUE(principaluri, uri), + UNIQUE(calendarid, principaluri), + UNIQUE(calendarid, share_href) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" + ); + + if($r1 && $r2 && $r3 && $r4 && $r5 && $r6 && $r7 && $r8 && $r9 && $r10 && $r11 && $r12 && $r13 && $r14 && $r15 && $r16) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + } + } +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1192.php b/Zotlabs/Update/_1192.php new file mode 100644 index 000000000..f2445da05 --- /dev/null +++ b/Zotlabs/Update/_1192.php @@ -0,0 +1,21 @@ +<?php + +namespace Zotlabs\Update; + +class _1192 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("CREATE INDEX item_obj_type ON item (obj_type)"); + } + else { + $r1 = q("ALTER TABLE item ADD INDEX (obj_type)"); + } + + if($r1) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1193.php b/Zotlabs/Update/_1193.php new file mode 100644 index 000000000..267e16da1 --- /dev/null +++ b/Zotlabs/Update/_1193.php @@ -0,0 +1,22 @@ +<?php + +namespace Zotlabs\Update; + +class _1193 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("CREATE INDEX item_uid_unseen ON item (uid, item_unseen)"); + } + else { + $r1 = q("ALTER TABLE item ADD INDEX uid_item_unseen (uid, item_unseen)"); + } + + if($r1) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1194.php b/Zotlabs/Update/_1194.php new file mode 100644 index 000000000..916723eaa --- /dev/null +++ b/Zotlabs/Update/_1194.php @@ -0,0 +1,22 @@ +<?php + +namespace Zotlabs\Update; + +class _1194 { +function run() { + $r = q("select id, resource_id from item where resource_type = 'nwiki'"); + if($r) { + foreach($r as $rv) { + $mimetype = get_iconfig($rv['id'],'wiki','mimeType'); + q("update item set mimetype = '%s' where resource_type = 'nwikipage' and resource_id = '%s'", + dbesc($mimetype), + dbesc($rv['resource_id']) + ); + } + } + + return UPDATE_SUCCESS; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1195.php b/Zotlabs/Update/_1195.php new file mode 100644 index 000000000..248e9a34a --- /dev/null +++ b/Zotlabs/Update/_1195.php @@ -0,0 +1,21 @@ +<?php + +namespace Zotlabs\Update; + +class _1195 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("CREATE INDEX item_resource_id ON item (resource_id)"); + } + else { + $r1 = q("ALTER TABLE item ADD INDEX (resource_id)"); + } + + if($r1) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1196.php b/Zotlabs/Update/_1196.php new file mode 100644 index 000000000..720252bf8 --- /dev/null +++ b/Zotlabs/Update/_1196.php @@ -0,0 +1,45 @@ +<?php + +namespace Zotlabs\Update; + +class _1196 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("CREATE TABLE \"pchan\" ( + \"pchan_id\" serial NOT NULL, + \"pchan_guid\" text NOT NULL, + \"pchan_hash\" text NOT NULL, + \"pchan_pubkey\" text NOT NULL, + \"pchan_prvkey\" text NOT NULL, + PRIMARY KEY (\"pchan_id\") +)"); + + $r2 = q("create index \"pchan_guid\" on pchan (\"pchan_guid\")"); + $r3 = q("create index \"pchan_hash\" on pchan (\"pchan_hash\")"); + + if($r1 && $r2 && $r3) { + return UPDATE_SUCCESS; + } + } + else { + $r1 = q("CREATE TABLE IF NOT EXISTS pchan ( + pchan_id int(11) UNSIGNED NOT NULL AUTO_INCREMENT, + pchan_guid char(191) NOT NULL DEFAULT '', + pchan_hash char(191) NOT NULL DEFAULT '', + pchan_pubkey text NOT NULL, + pchan_prvkey text NOT NULL, + PRIMARY KEY (pchan_id), + KEY pchan_guid (pchan_guid), + KEY pchan_hash (pchan_hash) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4"); + if($r1) { + return UPDATE_SUCCESS; + } + } + + return UPDATE_FAILED; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1197.php b/Zotlabs/Update/_1197.php new file mode 100644 index 000000000..72e4ca59d --- /dev/null +++ b/Zotlabs/Update/_1197.php @@ -0,0 +1,17 @@ +<?php + +namespace Zotlabs\Update; + +class _1197 { +function run() { + + $r = q("select diaspora_meta from item where true limit 1"); + if($r) { + $r = q("ALTER TABLE item DROP diaspora_meta"); + } + + return UPDATE_SUCCESS; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1198.php b/Zotlabs/Update/_1198.php new file mode 100644 index 000000000..0713bb6ce --- /dev/null +++ b/Zotlabs/Update/_1198.php @@ -0,0 +1,24 @@ +<?php + +namespace Zotlabs\Update; + +class _1198 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_MYSQL) { + $r = q("ALTER TABLE item + DROP INDEX item_blocked, + DROP INDEX item_unpublished, + DROP INDEX item_deleted, + DROP INDEX item_delayed, + DROP INDEX item_hidden, + DROP INDEX item_pending_remove, + DROP INDEX item_type + "); + } + + return UPDATE_SUCCESS; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1199.php b/Zotlabs/Update/_1199.php new file mode 100644 index 000000000..7ab03b073 --- /dev/null +++ b/Zotlabs/Update/_1199.php @@ -0,0 +1,19 @@ +<?php + +namespace Zotlabs\Update; + +class _1199 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_MYSQL) { + $r = q("ALTER TABLE item + DROP INDEX uid, + ADD INDEX (item_type) + "); + } + + return UPDATE_SUCCESS; +} + + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1200.php b/Zotlabs/Update/_1200.php new file mode 100644 index 000000000..00c742593 --- /dev/null +++ b/Zotlabs/Update/_1200.php @@ -0,0 +1,20 @@ +<?php + +namespace Zotlabs\Update; + +class _1200 { +function run() { + + if(ACTIVE_DBTYPE == DBTYPE_MYSQL) { + $r = q("ALTER TABLE item + DROP INDEX item_type, + ADD INDEX uid_item_type (uid, item_type) + "); + } + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +}
\ No newline at end of file diff --git a/Zotlabs/Update/_1201.php b/Zotlabs/Update/_1201.php new file mode 100644 index 000000000..c12797377 --- /dev/null +++ b/Zotlabs/Update/_1201.php @@ -0,0 +1,15 @@ +<?php + +namespace Zotlabs\Update; + +class _1201 { + + function run() { + + // empty update in order to make the DB_UPDATE_VERSION equal to the current maximum update function + // rather than being one greater than the last known update + + return UPDATE_SUCCESS; + + } +}
\ No newline at end of file diff --git a/install/update.php b/install/update.php deleted file mode 100644 index d5ad394f4..000000000 --- a/install/update.php +++ /dev/null @@ -1,3115 +0,0 @@ -<?php - -define( 'UPDATE_VERSION' , 1201 ); - -/** - * - * update.php - automatic system update - * - * Automatically update database schemas and any other development changes such that - * copying the latest files from the source code repository will always perform a clean - * and painless upgrade. - * - * Each function in this file is named update_rnnnn() where nnnn is an increasing number - * which began counting at 1000. - * - * At the top of the file "boot.php" is a define for DB_UPDATE_VERSION. Any time there is a change - * to the database schema or one which requires an upgrade path from the existing application, - * the DB_UPDATE_VERSION and the UPDATE_VERSION at the top of this file are incremented. - * - * The current DB_UPDATE_VERSION is stored in the config area of the database. If the application starts up - * and DB_UPDATE_VERSION is greater than the last stored build number, we will process every update function - * in order from the currently stored value to the new DB_UPDATE_VERSION. This is expected to bring the system - * up to current without requiring re-installation or manual intervention. - * - * Once the upgrade functions have completed, the current DB_UPDATE_VERSION is stored as the current value. - * The DB_UPDATE_VERSION will always be one greater than the last numbered script in this file. - * - * If you change the database schema, the following are required: - * 1. Update the files schema_mysql.sql and schema_postgres.sql to match the new schema. - * Be sure to read doc/sql_conventions.bb ($yoururl/help/sql_conventions) use only standard - * SQL data types where possible to keep differences in the files to a minimum - * 2. Update this file by adding a new function at the end with the number of the current DB_UPDATE_VERSION. - * This function should modify the current database schema and perform any other steps necessary - * to ensure that upgrade is silent and free from requiring interaction. Review to ensure that it - * will run correctly on both postgres and MySQL/Mariadb. It is very difficult and messy to fix DB update - * errors. Once pushed, it requires a new update which undoes any damage and performs the corrected updated. - * 3. Increment the DB_UPDATE_VERSION in boot.php *AND* the UPDATE_VERSION in this file to match it - * 4. TEST the upgrade prior to checkin and filing a pull request. - * - */ - -function update_r1000() { - $r = q("ALTER TABLE `channel` ADD `channel_a_delegate` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0', ADD INDEX ( `channel_a_delegate` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1001() { - $r = q("CREATE TABLE if not exists `verify` ( - `id` INT(10) UNSIGNED NOT NULL , - `channel` INT(10) UNSIGNED NOT NULL DEFAULT '0', - `type` CHAR( 32 ) NOT NULL DEFAULT '', - `token` CHAR( 255 ) NOT NULL DEFAULT '', - `meta` CHAR( 255 ) NOT NULL DEFAULT '', - `created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', - PRIMARY KEY ( `id` ) - ) ENGINE = MYISAM DEFAULT CHARSET=utf8"); - - $r2 = q("alter table `verify` add index (`channel`), add index (`type`), add index (`token`), - add index (`meta`), add index (`created`)"); - - if($r && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1002() { - $r = q("ALTER TABLE `event` CHANGE `account` `aid` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); - $r2 = q("alter table `event` drop index `account`, add index (`aid`)"); - - q("drop table contact"); - q("drop table deliverq"); - - if($r && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1003() { - $r = q("ALTER TABLE `xchan` ADD `xchan_flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `xchan_network` , -ADD INDEX ( `xchan_flags` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1004() { - $r = q("CREATE TABLE if not exists `site` ( -`site_url` CHAR( 255 ) NOT NULL , -`site_flags` INT NOT NULL DEFAULT '0', -`site_update` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', -`site_directory` CHAR( 255 ) NOT NULL DEFAULT '', -PRIMARY KEY ( `site_url` ) -) ENGINE = MYISAM DEFAULT CHARSET=utf8"); - - $r2 = q("alter table site add index (site_flags), add index (site_update), add index (site_directory) "); - - if($r && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1005() { - q("drop table guid"); - q("drop table `notify-threads`"); - return UPDATE_SUCCESS; -} - -function update_r1006() { - - $r = q("CREATE TABLE IF NOT EXISTS `xprof` ( - `xprof_hash` char(255) NOT NULL, - `xprof_desc` char(255) NOT NULL DEFAULT '', - `xprof_dob` char(12) NOT NULL DEFAULT '', - `xprof_gender` char(255) NOT NULL DEFAULT '', - `xprof_marital` char(255) NOT NULL DEFAULT '', - `xprof_sexual` char(255) NOT NULL DEFAULT '', - `xprof_locale` char(255) NOT NULL DEFAULT '', - `xprof_region` char(255) NOT NULL DEFAULT '', - `xprof_postcode` char(32) NOT NULL DEFAULT '', - `xprof_country` char(255) NOT NULL DEFAULT '', - PRIMARY KEY (`xprof_hash`), - KEY `xprof_desc` (`xprof_desc`), - KEY `xprof_dob` (`xprof_dob`), - KEY `xprof_gender` (`xprof_gender`), - KEY `xprof_marital` (`xprof_marital`), - KEY `xprof_sexual` (`xprof_sexual`), - KEY `xprof_locale` (`xprof_locale`), - KEY `xprof_region` (`xprof_region`), - KEY `xprof_postcode` (`xprof_postcode`), - KEY `xprof_country` (`xprof_country`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8"); - - $r2 = q("CREATE TABLE IF NOT EXISTS `xtag` ( - `xtag_hash` char(255) NOT NULL, - `xtag_term` char(255) NOT NULL DEFAULT '', - PRIMARY KEY (`xtag_hash`), - KEY `xtag_term` (`xtag_term`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8"); - - if($r && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1007() { - $r = q("ALTER TABLE `channel` ADD `channel_r_storage` INT UNSIGNED NOT NULL DEFAULT '128', ADD `channel_w_storage` INT UNSIGNED NOT NULL DEFAULT '128', add index ( channel_r_storage ), add index ( channel_w_storage )"); - - if($r && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1008() { - $r = q("alter table profile drop prv_keywords, CHANGE `pub_keywords` `keywords` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, drop index pub_keywords"); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1009() { - $r = q("ALTER TABLE `xprof` ADD `xprof_keywords` TEXT NOT NULL"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1010() { - $r = q("ALTER TABLE `abook` ADD `abook_dob` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `abook_connnected` , -ADD INDEX ( `abook_dob` )"); - - $r2 = q("ALTER TABLE `profile` ADD `dob_tz` CHAR( 255 ) NOT NULL DEFAULT 'UTC' AFTER `dob`"); - - if($r && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1011() { - $r = q("ALTER TABLE `item` ADD `expires` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `edited` , -ADD INDEX ( `expires` )"); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1012() { - $r = q("ALTER TABLE `xchan` ADD `xchan_connurl` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_url` , -ADD INDEX ( `xchan_connurl` )"); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1013() { - $r = q("CREATE TABLE if not exists `xlink` ( -`xlink_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , -`xlink_xchan` CHAR( 255 ) NOT NULL DEFAULT '', -`xlink_link` CHAR( 255 ) NOT NULL DEFAULT '', -`xlink_updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' -) ENGINE = MYISAM DEFAULT CHARSET=utf8"); - - $r2 = q("alter table xlink add index ( xlink_xchan ), add index ( xlink_link ), add index ( xlink_updated ) "); - if($r && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1014() { - $r = q("ALTER TABLE `verify` CHANGE `id` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1015() { - $r = q("ALTER TABLE `channel` ADD `channel_r_pages` INT UNSIGNED NOT NULL DEFAULT '128', -ADD `channel_w_pages` INT UNSIGNED NOT NULL DEFAULT '128'"); - - $r2 = q("ALTER TABLE `channel` ADD INDEX ( `channel_r_pages` ) , ADD INDEX ( `channel_w_pages` ) "); - - if($r && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1016() { - - $r = q("CREATE TABLE IF NOT EXISTS `menu` ( - `menu_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `menu_channel_id` int(10) unsigned NOT NULL DEFAULT '0', - `menu_desc` char(255) NOT NULL DEFAULT '', - PRIMARY KEY (`menu_id`), - KEY `menu_channel_id` (`menu_channel_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - - $r2 = q("CREATE TABLE IF NOT EXISTS `menu_item` ( - `mitem_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `mitem_link` char(255) NOT NULL DEFAULT '', - `mitem_desc` char(255) NOT NULL DEFAULT '', - `allow_cid` mediumtext NOT NULL, - `allow_gid` mediumtext NOT NULL, - `deny_cid` mediumtext NOT NULL, - `deny_gid` mediumtext NOT NULL, - `mitem_channel_id` int(10) unsigned NOT NULL, - `mitem_menu_id` int(10) unsigned NOT NULL DEFAULT '0', - `mitem_order` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`mitem_id`), - KEY `mitem_channel_id` (`mitem_channel_id`), - KEY `mitem_menu_id` (`mitem_menu_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - - - if($r && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1017() { - $r = q("ALTER TABLE `event` CHANGE `cid` `event_xchan` CHAR( 255 ) NOT NULL DEFAULT '', ADD INDEX ( `event_xchan` ), drop index cid "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1018() { - $r = q("ALTER TABLE `event` ADD `event_hash` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `event_xchan` , -ADD INDEX ( `event_hash` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1019() { - $r = q("ALTER TABLE `event` DROP `message_id` "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1020() { - $r = q("alter table photo drop `contact-id`, drop guid, drop index `resource-id`, add index ( `resource_id` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1021() { - - $r = q("ALTER TABLE `abook` CHANGE `abook_connnected` `abook_connected` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', - drop index `abook_connnected`, add index ( `abook_connected` ) "); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1022() { - $r = q("alter table attach add index ( filename ), add index ( filetype ), add index ( filesize ), add index ( created ), add index ( edited ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1023() { - $r = q("ALTER TABLE `item` ADD `revision` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `lang` , add index ( revision ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1024() { - $r = q("ALTER TABLE `attach` ADD `revision` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `filesize` , -ADD INDEX ( `revision` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1025() { - $r = q("ALTER TABLE `attach` ADD `folder` CHAR( 64 ) NOT NULL DEFAULT '' AFTER `revision` , -ADD `flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `folder` , add index ( folder ), add index ( flags )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1026() { - $r = q("ALTER TABLE `item` ADD `mimetype` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `author_xchan` , -ADD INDEX ( `mimetype` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1027() { - $r = q("ALTER TABLE `abook` ADD `abook_rating` INT NOT NULL DEFAULT '0' AFTER `abook_closeness` , -ADD INDEX ( `abook_rating` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1028() { - $r = q("ALTER TABLE `xlink` ADD `xlink_rating` INT NOT NULL DEFAULT '0' AFTER `xlink_link` , -ADD INDEX ( `xlink_rating` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1029() { - $r = q("ALTER TABLE `channel` ADD `channel_deleted` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `channel_pageflags` , -ADD INDEX ( `channel_deleted` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1030() { - $r = q("CREATE TABLE IF NOT EXISTS `issue` ( -`issue_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , -`issue_created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', -`issue_updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', -`issue_assigned` CHAR( 255 ) NOT NULL , -`issue_priority` INT NOT NULL , -`issue_status` INT NOT NULL , -`issue_component` CHAR( 255 ) NOT NULL, -KEY `issue_created` (`issue_created`), -KEY `issue_updated` (`issue_updated`), -KEY `issue_assigned` (`issue_assigned`), -KEY `issue_priority` (`issue_priority`), -KEY `issue_status` (`issue_status`), -KEY `issue_component` (`issue_component`) -) ENGINE = MYISAM DEFAULT CHARSET=utf8"); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1031() { - $r = q("ALTER TABLE `account` ADD `account_external` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `account_email` , -ADD INDEX ( `account_external` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1032() { - $r = q("CREATE TABLE if not exists `xign` ( -`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , -`uid` INT NOT NULL DEFAULT '0', -`xchan` CHAR( 255 ) NOT NULL DEFAULT '', -KEY `uid` (`uid`), -KEY `xchan` (`xchan`) -) ENGINE = MYISAM DEFAULT CHARSET = utf8"); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1033() { - $r = q("CREATE TABLE if not exists `shares` ( -`share_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , -`share_type` INT NOT NULL DEFAULT '0', -`share_target` INT UNSIGNED NOT NULL DEFAULT '0', -`share_xchan` CHAR( 255 ) NOT NULL DEFAULT '', -KEY `share_type` (`share_type`), -KEY `share_target` (`share_target`), -KEY `share_xchan` (`share_xchan`) -) ENGINE = MYISAM DEFAULT CHARSET = utf8"); - - // if these fail don't bother reporting it - - q("drop table gcign"); - q("drop table gcontact"); - q("drop table glink"); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1034() { - $r = q("CREATE TABLE if not exists `updates` ( -`ud_hash` CHAR( 128 ) NOT NULL , -`ud_date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', -PRIMARY KEY ( `ud_hash` ), -KEY `ud_date` ( `ud_date` ) -) ENGINE = MYISAM DEFAULT CHARSET = utf8"); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1035() { - $r = q("CREATE TABLE if not exists `xconfig` ( -`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , -`xchan` CHAR( 255 ) NOT NULL , -`cat` CHAR( 255 ) NOT NULL , -`k` CHAR( 255 ) NOT NULL , -`v` MEDIUMTEXT NOT NULL, -KEY `xchan` ( `xchan` ), -KEY `cat` ( `cat` ), -KEY `k` ( `k` ) -) ENGINE = MYISAM DEFAULT CHARSET = utf8"); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1036() { - $r = q("ALTER TABLE `profile` ADD `channels` TEXT NOT NULL AFTER `contact` "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - - -function update_r1037() { - $r1 = q("ALTER TABLE `item` CHANGE `uri` `mid` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '', -CHANGE `parent_uri` `parent_mid` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '', - DROP INDEX `uri` , -ADD INDEX `mid` ( `mid` ), -DROP INDEX `parent_uri` , -ADD INDEX `parent_mid` ( `parent_mid` ), - DROP INDEX `uid_uri` , -ADD INDEX `uid_mid` ( `mid` , `uid` ) "); - - $r2 = q("ALTER TABLE `mail` CHANGE `uri` `mid` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , -CHANGE `parent_uri` `parent_mid` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , -DROP INDEX `uri` , -ADD INDEX `mid` ( `mid` ), - DROP INDEX `parent_uri` , -ADD INDEX `parent_mid` ( `parent_mid` ) "); - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1038() { - $r = q("ALTER TABLE `manage` CHANGE `mid` `xchan` CHAR( 255 ) NOT NULL DEFAULT '', drop index `mid`, ADD INDEX ( `xchan` )"); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - - -function update_r1039() { - $r = q("ALTER TABLE `channel` CHANGE `channel_default_gid` `channel_default_group` CHAR( 255 ) NOT NULL DEFAULT ''"); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1040() { - $r1 = q("ALTER TABLE `session` CHANGE `expire` `expire` BIGINT UNSIGNED NOT NULL "); - $r2 = q("ALTER TABLE `tokens` CHANGE `expires` `expires` BIGINT UNSIGNED NOT NULL "); - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1041() { - $r = q("ALTER TABLE `outq` ADD `outq_driver` CHAR( 32 ) NOT NULL DEFAULT '' AFTER `outq_channel` "); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1042() { - $r = q("ALTER TABLE `hubloc` ADD `hubloc_updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', -ADD `hubloc_connected` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( `hubloc_updated` ), ADD INDEX ( `hubloc_connected` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1043() { - $r = q("ALTER TABLE `item` ADD `comment_policy` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `coord` , -ADD INDEX ( `comment_policy` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1044() { - $r = q("ALTER TABLE `term` ADD `imgurl` CHAR( 255 ) NOT NULL , -ADD INDEX ( `imgurl` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1045() { - $r = q("ALTER TABLE `site` ADD `site_register` INT NOT NULL DEFAULT '0', -ADD INDEX ( `site_register` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1046() { - $r = q("ALTER TABLE `term` ADD `term_hash` CHAR( 255 ) NOT NULL DEFAULT '', -ADD INDEX ( `term_hash` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1047() { - $r = q("ALTER TABLE `xprof` ADD `xprof_age` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `xprof_hash` , -ADD INDEX ( `xprof_age` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1048() { - $r = q("CREATE TABLE IF NOT EXISTS `obj` ( - `obj_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `obj_page` char(64) NOT NULL DEFAULT '', - `obj_verb` char(255) NOT NULL DEFAULT '', - `obj_type` int(10) unsigned NOT NULL DEFAULT '0', - `obj_obj` char(255) NOT NULL DEFAULT '', - `obj_channel` int(10) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`obj_id`), - KEY `obj_verb` (`obj_verb`), - KEY `obj_page` (`obj_page`), - KEY `obj_type` (`obj_type`), - KEY `obj_channel` (`obj_channel`), - KEY `obj_obj` (`obj_obj`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1049() { - $r = q("ALTER TABLE `term` ADD `parent_hash` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `term_hash` , ADD INDEX ( `parent_hash` ) "); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1050() { - $r = q("ALTER TABLE `xtag` DROP PRIMARY KEY , ADD `xtag_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST , ADD INDEX ( `xtag_hash` ) "); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1051() { - $r = q("ALTER TABLE `photo` ADD `photo_flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `profile` , ADD INDEX ( `photo_flags` ) "); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1052() { - $r = q("ALTER TABLE `channel` ADD UNIQUE (`channel_address`) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1053() { - $r = q("ALTER TABLE `profile` ADD `chandesc` TEXT NOT NULL DEFAULT '' AFTER `pdesc` "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1054() { - $r = q("ALTER TABLE `item` CHANGE `title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1055() { - $r = q("ALTER TABLE `mail` CHANGE `title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1056() { - $r = q("ALTER TABLE `xchan` ADD `xchan_instance_url` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_network` , -ADD INDEX ( `xchan_instance_url` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1057() { - $r = q("drop table intro"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1058() { - $r1 = q("ALTER TABLE `menu` ADD `menu_name` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `menu_channel_id` , -ADD INDEX ( `menu_name` ) "); - - $r2 = q("ALTER TABLE `menu_item` ADD `mitem_flags` INT NOT NULL DEFAULT '0' AFTER `mitem_desc` , -ADD INDEX ( `mitem_flags` ) "); - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1059() { - $r = q("ALTER TABLE `mail` ADD `attach` MEDIUMTEXT NOT NULL DEFAULT '' AFTER `body` "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1060() { - - $r = q("CREATE TABLE IF NOT EXISTS `vote` ( - `vote_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `vote_poll` int(11) NOT NULL DEFAULT '0', - `vote_element` int(11) NOT NULL DEFAULT '0', - `vote_result` text NOT NULL, - `vote_xchan` char(255) NOT NULL DEFAULT '', - PRIMARY KEY (`vote_id`), - UNIQUE KEY `vote_vote` (`vote_poll`,`vote_element`,`vote_xchan`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1061() { - $r = q("ALTER TABLE `vote` ADD INDEX ( `vote_poll` ), ADD INDEX ( `vote_element` ) "); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1062() { - $r1 = q("CREATE TABLE IF NOT EXISTS `poll` ( -`poll_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , -`poll_channel` INT UNSIGNED NOT NULL DEFAULT '0', -`poll_desc` TEXT NOT NULL DEFAULT '', -`poll_flags` INT NOT NULL DEFAULT '0', -`poll_votes` INT NOT NULL DEFAULT '0', -KEY `poll_channel` (`poll_channel`), -KEY `poll_flags` (`poll_flags`), -KEY `poll_votes` (`poll_votes`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - - $r2 = q("CREATE TABLE IF NOT EXISTS `poll_elm` ( -`pelm_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , -`pelm_poll` INT UNSIGNED NOT NULL DEFAULT '0', -`pelm_desc` TEXT NOT NULL DEFAULT '', -`pelm_flags` INT NOT NULL DEFAULT '0', -`pelm_result` FLOAT NOT NULL DEFAULT '0', -KEY `pelm_poll` (`pelm_poll`), -KEY `pelm_result` (`pelm_result`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1063() { - $r = q("ALTER TABLE `xchan` ADD `xchan_follow` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_connurl` , -ADD `xchan_connpage` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_follow` , -ADD INDEX ( `xchan_follow` ), ADD INDEX ( `xchan_connpage`) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1064() { - $r = q("ALTER TABLE `updates` ADD `ud_guid` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `ud_hash` , -ADD INDEX ( `ud_guid` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1065() { - $r = q("ALTER TABLE `item` DROP `wall`, ADD `layout_mid` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `target` , -ADD INDEX ( `layout_mid` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1066() { - $r = q("ALTER TABLE `site` ADD `site_access` INT NOT NULL DEFAULT '0' AFTER `site_url` , -ADD INDEX ( `site_access` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1067() { - $r = q("ALTER TABLE `updates` DROP PRIMARY KEY , ADD `ud_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST, ADD INDEX ( `ud_hash` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1068(){ - $r = q("ALTER TABLE `hubloc` ADD `hubloc_status` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `hubloc_flags` , ADD INDEX ( `hubloc_status` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1069() { - $r = q("ALTER TABLE `site` ADD `site_sellpage` CHAR( 255 ) NOT NULL DEFAULT '', -ADD INDEX ( `site_sellpage` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1070() { - $r = q("ALTER TABLE `updates` ADD `ud_flags` INT NOT NULL DEFAULT '0', -ADD INDEX ( `ud_flags` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1071() { - $r = q("ALTER TABLE `updates` ADD `ud_addr` CHAR( 255 ) NOT NULL DEFAULT '', -ADD INDEX ( `ud_addr` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1072() { - $r = q("ALTER TABLE `xtag` ADD `xtag_flags` INT NOT NULL DEFAULT '0', -ADD INDEX ( `xtag_flags` ) "); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1073() { - $r1 = q("CREATE TABLE IF NOT EXISTS `source` ( -`src_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , -`src_channel_id` INT UNSIGNED NOT NULL DEFAULT '0', -`src_channel_xchan` CHAR( 255 ) NOT NULL DEFAULT '', -`src_xchan` CHAR( 255 ) NOT NULL DEFAULT '', -`src_patt` MEDIUMTEXT NOT NULL DEFAULT '' -) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - - $r2 = q("ALTER TABLE `source` ADD INDEX ( `src_channel_id` ), ADD INDEX ( `src_channel_xchan` ), ADD INDEX ( `src_xchan` ) "); - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1074() { - $r1 = q("ALTER TABLE `site` ADD `site_sync` DATETIME NOT NULL AFTER `site_update` "); - - $r2 = q("ALTER TABLE `updates` ADD `ud_last` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `ud_date` , -ADD INDEX ( `ud_last` ) "); - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1075() { - $r = q("ALTER TABLE `channel` ADD `channel_a_republish` INT UNSIGNED NOT NULL DEFAULT '128', -ADD INDEX ( `channel_a_republish` )"); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1076() { - $r = q("ALTER TABLE `item` CHANGE `inform` `sig` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1077() { - $r = q("ALTER TABLE `item` ADD `source_xchan` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `author_xchan` "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1078() { - $r = q("ALTER TABLE `channel` ADD `channel_dirdate` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `channel_pageflags` , ADD INDEX ( `channel_dirdate` )"); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1079() { - $r = q("ALTER TABLE `site` ADD `site_location` CHAR( 255 ) NOT NULL DEFAULT ''"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1080() { - $r = q("ALTER TABLE `mail` ADD `expires` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', -ADD INDEX ( `expires` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1081() { - $r = q("DROP TABLE `queue` "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1082() { - $r = q("DROP TABLE `challenge` "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1083() { - $r = q("ALTER TABLE `notify` ADD `aid` INT NOT NULL AFTER `msg` , -ADD INDEX ( `aid` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1084() { - - - $r = q("CREATE TABLE if not exists `sys_perms` ( - `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , - `cat` CHAR( 255 ) NOT NULL , - `k` CHAR( 255 ) NOT NULL , - `v` MEDIUMTEXT NOT NULL, - `public_perm` TINYINT( 1 ) UNSIGNED NOT NULL -) ENGINE = MYISAM DEFAULT CHARSET = utf8"); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1085() { - $r1 = q("ALTER TABLE `photo` CHANGE `desc` `description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL "); - - $r2 = q("RENAME TABLE `group` TO `groups`"); - - $r3 = q("ALTER TABLE `event` CHANGE `desc` `description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL "); - - if($r1 && $r2 && $r3) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1086() { - $r = q("ALTER TABLE `account` ADD `account_level` INT UNSIGNED NOT NULL DEFAULT '0', -ADD INDEX ( `account_level` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1087() { - $r = q("ALTER TABLE `xprof` ADD `xprof_about` TEXT NOT NULL DEFAULT '', -ADD `xprof_homepage` CHAR( 255 ) NOT NULL DEFAULT '', -ADD `xprof_hometown` CHAR( 255 ) NOT NULL DEFAULT '', -ADD INDEX ( `xprof_hometown` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1088() { - $r = q("ALTER TABLE `obj` ADD `allow_cid` MEDIUMTEXT NOT NULL DEFAULT '', -ADD `allow_gid` MEDIUMTEXT NOT NULL DEFAULT '', -ADD `deny_cid` MEDIUMTEXT NOT NULL DEFAULT '', -ADD `deny_gid` MEDIUMTEXT NOT NULL DEFAULT ''"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1089() { - $r = q("ALTER TABLE `attach` ADD `creator` CHAR( 128 ) NOT NULL DEFAULT '' AFTER `hash` , -ADD INDEX ( `creator` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1090() { - $r = q("ALTER TABLE `menu` ADD `menu_flags` INT NOT NULL DEFAULT '0', -ADD INDEX ( `menu_flags` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1091() { - @os_mkdir('store/[data]/smarty3',STORAGE_DEFAULT_PERMISSIONS,true); - @file_put_contents('store/[data]/locks',''); - return UPDATE_SUCCESS; -} - -function update_r1092() { - $r1 = q("CREATE TABLE IF NOT EXISTS `chat` ( - `chat_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `chat_room` int(10) unsigned NOT NULL DEFAULT '0', - `chat_xchan` char(255) NOT NULL DEFAULT '', - `chat_text` mediumtext NOT NULL, - `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', - PRIMARY KEY (`chat_id`), - KEY `chat_room` (`chat_room`), - KEY `chat_xchan` (`chat_xchan`), - KEY `created` (`created`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8"); - - $r2 = q("CREATE TABLE IF NOT EXISTS `chatpresence` ( - `cp_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `cp_room` int(10) unsigned NOT NULL DEFAULT '0', - `cp_xchan` char(255) NOT NULL DEFAULT '', - `cp_last` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', - `cp_status` char(255) NOT NULL, - PRIMARY KEY (`cp_id`), - KEY `cp_room` (`cp_room`), - KEY `cp_xchan` (`cp_xchan`), - KEY `cp_last` (`cp_last`), - KEY `cp_status` (`cp_status`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8"); - - $r3 = q("CREATE TABLE IF NOT EXISTS `chatroom` ( - `cr_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `cr_aid` int(10) unsigned NOT NULL DEFAULT '0', - `cr_uid` int(10) unsigned NOT NULL DEFAULT '0', - `cr_name` char(255) NOT NULL DEFAULT '', - `cr_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', - `cr_edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', - `allow_cid` mediumtext NOT NULL, - `allow_gid` mediumtext NOT NULL, - `deny_cid` mediumtext NOT NULL, - `deny_gid` mediumtext NOT NULL, - PRIMARY KEY (`cr_id`), - KEY `cr_aid` (`cr_aid`), - KEY `cr_uid` (`cr_uid`), - KEY `cr_name` (`cr_name`), - KEY `cr_created` (`cr_created`), - KEY `cr_edited` (`cr_edited`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8"); - - - if($r1 && $r2 && $r3) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - - - -function update_r1093() { - $r = q("ALTER TABLE `chatpresence` ADD `cp_client` CHAR( 128 ) NOT NULL DEFAULT ''"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1094() { - $r = q("ALTER TABLE `chatroom` ADD `cr_expire` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `cr_edited` , -ADD INDEX ( `cr_expire` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1095() { - $r = q("ALTER TABLE `channel` ADD `channel_a_bookmark` INT UNSIGNED NOT NULL DEFAULT '128', -ADD INDEX ( `channel_a_bookmark` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1096() { - $r = q("ALTER TABLE `account` CHANGE `account_level` `account_level` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1097() { - - // fix some mangled hublocs from a bug long ago - - $r = q("select hubloc_id, hubloc_addr from hubloc where hubloc_addr like '%%/%%'"); - if($r) { - foreach($r as $rr) { - q("update hubloc set hubloc_addr = '%s' where hubloc_id = %d", - dbesc(substr($rr['hubloc_addr'],0,strpos($rr['hubloc_addr'],'/'))), - intval($rr['hubloc_id']) - ); - } - } - return UPDATE_SUCCESS; - -} - -function update_r1098() { - $r = q("ALTER TABLE `channel` CHANGE `channel_r_stream` `channel_r_stream` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); - $r2 = q("ALTER TABLE `channel` CHANGE `channel_r_profile` `channel_r_profile` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); - $r3 = q("ALTER TABLE `channel` CHANGE `channel_r_photos` `channel_r_photos` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); - $r4 = q("ALTER TABLE `channel` CHANGE `channel_r_abook` `channel_r_abook` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); - $r4 = q("ALTER TABLE `channel` CHANGE `channel_w_stream` `channel_w_stream` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); - $r5 = q("ALTER TABLE `channel` CHANGE `channel_w_wall` `channel_w_wall` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); - $r6 = q("ALTER TABLE `channel` CHANGE `channel_w_tagwall` `channel_w_tagwall` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); - $r7 = q("ALTER TABLE `channel` CHANGE `channel_w_comment` `channel_w_comment` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); - $r8 = q("ALTER TABLE `channel` CHANGE `channel_w_mail` `channel_w_mail` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); - $r9 = q("ALTER TABLE `channel` CHANGE `channel_w_photos` `channel_w_photos` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); - $r10 = q("ALTER TABLE `channel` CHANGE `channel_w_chat` `channel_w_chat` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); - $r11 = q("ALTER TABLE `channel` CHANGE `channel_a_delegate` `channel_a_delegate` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); - if($r && $r2 && $r3 && $r3 && $r5 && $r6 && $r7 && $r8 && $r9 && $r9 && $r10 && $r11) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1099() { - $r = q("CREATE TABLE IF NOT EXISTS `xchat` ( - `xchat_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `xchat_url` char(255) NOT NULL DEFAULT '', - `xchat_desc` char(255) NOT NULL DEFAULT '', - `xchat_xchan` char(255) NOT NULL DEFAULT '', - PRIMARY KEY (`xchat_id`), - KEY `xchat_url` (`xchat_url`), - KEY `xchat_desc` (`xchat_desc`), - KEY `xchat_xchan` (`xchat_xchan`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1100() { - $r = q("ALTER TABLE `xchat` ADD `xchat_edited` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', -ADD INDEX ( `xchat_edited` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1101() { - $r = q("update updates set ud_flags = 2 where ud_flags = (-1)"); - $r = q("update updates set ud_flags = 0 where ud_flags = 4096"); - return UPDATE_SUCCESS; -} - -function update_r1102() { - $r = q("update abook set abook_flags = (abook_flags - %d) - where ( abook_flags & %d)", - intval(ABOOK_FLAG_UNCONNECTED), - intval(ABOOK_FLAG_UNCONNECTED) - ); - return UPDATE_SUCCESS; -} - -function update_r1103() { - $x = curl_version(); - if(stristr($x['ssl_version'],'openssl')) - set_config('system','curl_ssl_ciphers','ALL:!eNULL'); - return UPDATE_SUCCESS; -} - -function update_r1104() { - $r = q("ALTER TABLE `item` ADD `route` TEXT NOT NULL DEFAULT '' AFTER `postopts` "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1105() { - $r = q("ALTER TABLE `site` ADD `site_pull` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `site_update` , -CHANGE `site_sync` `site_sync` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( `site_pull` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1106() { - $r = q("ALTER TABLE `notify` CHANGE `parent` `parent` CHAR( 255 ) NOT NULL DEFAULT ''"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1107() { - $r = q("CREATE TABLE IF NOT EXISTS `app` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `app_id` char(64) NOT NULL DEFAULT '', - `app_sig` char(255) NOT NULL DEFAULT '', - `app_author` char(255) NOT NULL DEFAULT '', - `app_name` char(255) NOT NULL DEFAULT '', - `app_desc` text NOT NULL, - `app_url` char(255) NOT NULL DEFAULT '', - `app_photo` char(255) NOT NULL DEFAULT '', - `app_version` char(255) NOT NULL DEFAULT '', - `app_channel` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `app_id` (`app_id`), - KEY `app_name` (`app_name`), - KEY `app_url` (`app_url`), - KEY `app_photo` (`app_photo`), - KEY `app_version` (`app_version`), - KEY `app_channel` (`app_channel`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1108() { - $r = q("ALTER TABLE `app` ADD `app_addr` CHAR( 255 ) NOT NULL DEFAULT '', -ADD `app_price` CHAR( 255 ) NOT NULL DEFAULT '', -ADD `app_page` CHAR( 255 ) NOT NULL DEFAULT '', -ADD INDEX ( `app_price` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1109() { - $r = q("ALTER TABLE `app` CHANGE `app_id` `app_id` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -// We ended up with an extra zero in the name for 1108, so do it over and ignore the result. - -function update_r1110() { - $r = q("ALTER TABLE `app` ADD `app_addr` CHAR( 255 ) NOT NULL DEFAULT '', -ADD `app_price` CHAR( 255 ) NOT NULL DEFAULT '', -ADD `app_page` CHAR( 255 ) NOT NULL DEFAULT '', -ADD INDEX ( `app_price` )"); - - return UPDATE_SUCCESS; - -} - -function update_r1111() { - $r = q("ALTER TABLE `app` ADD `app_requires` CHAR( 255 ) NOT NULL DEFAULT '' "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1112() { - $r = q("CREATE TABLE IF NOT EXISTS `likes` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `liker` char(128) NOT NULL DEFAULT '', - `likee` char(128) NOT NULL DEFAULT '', - `iid` int(11) NOT NULL DEFAULT '0', - `verb` char(255) NOT NULL DEFAULT '', - `target_type` char(255) NOT NULL DEFAULT '', - `target` mediumtext NOT NULL, - PRIMARY KEY (`id`), - KEY `liker` (`liker`), - KEY `likee` (`likee`), - KEY `iid` (`iid`), - KEY `verb` (`verb`), - KEY `target_type` (`target_type`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8"); - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1113() { - $r = q("ALTER TABLE `likes` ADD `channel_id` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `id` , -CHANGE `iid` `iid` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0', -ADD INDEX ( `channel_id` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1114() { - $r = q("ALTER TABLE `likes` ADD `target_id` CHAR( 128 ) NOT NULL DEFAULT '' AFTER `target_type` , -ADD INDEX ( `target_id` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1115() { - - // Introducing email verification. Mark all existing accounts as verified or they - // won't be able to login. - - $r = q("update account set account_flags = (account_flags ^ 1) where (account_flags & 1) "); - return UPDATE_SUCCESS; -} - -function update_r1116() { - @os_mkdir('store/[data]/smarty3',STORAGE_DEFAULT_PERMISSIONS,true); - return UPDATE_SUCCESS; -} - -function update_r1117() { - $r = q("ALTER TABLE `channel` CHANGE `channel_a_bookmark` `channel_w_like` INT( 10 ) UNSIGNED NOT NULL DEFAULT '128', -DROP INDEX `channel_a_bookmark` , ADD INDEX `channel_w_like` ( `channel_w_like` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1118() { - $r = q("ALTER TABLE `account` ADD `account_password_changed` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', -ADD INDEX ( `account_password_changed` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1119() { - $r1 = q("CREATE TABLE IF NOT EXISTS `profdef` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `field_name` char(255) NOT NULL DEFAULT '', - `field_type` char(16) NOT NULL DEFAULT '', - `field_desc` char(255) NOT NULL DEFAULT '', - `field_help` char(255) NOT NULL DEFAULT '', - PRIMARY KEY (`id`), - KEY `field_name` (`field_name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8"); - - $r2 = q("CREATE TABLE IF NOT EXISTS `profext` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `channel_id` int(10) unsigned NOT NULL DEFAULT '0', - `hash` char(255) NOT NULL DEFAULT '', - `k` char(255) NOT NULL DEFAULT '', - `v` mediumtext NOT NULL, - PRIMARY KEY (`id`), - KEY `channel_id` (`channel_id`), - KEY `hash` (`hash`), - KEY `k` (`k`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8"); - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1120() { - $r = q("ALTER TABLE `item` ADD `public_policy` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `coord` , -ADD INDEX ( `public_policy` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1121() { - $r = q("ALTER TABLE `site` ADD `site_realm` CHAR( 255 ) NOT NULL DEFAULT '', -ADD INDEX ( `site_realm` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1122() { - $r = q("update site set site_realm = '%s' where true", - dbesc(DIRECTORY_REALM) - ); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1123() { - $r1 = q("ALTER TABLE `hubloc` ADD `hubloc_network` CHAR( 32 ) NOT NULL DEFAULT '' AFTER `hubloc_addr` , -ADD INDEX ( `hubloc_network` )"); - $r2 = q("update hubloc set hubloc_network = 'zot' where true"); - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1124() { - $r1 = q("CREATE TABLE IF NOT EXISTS `sign` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `iid` int(10) unsigned NOT NULL DEFAULT '0', - `retract_iid` int(10) unsigned NOT NULL DEFAULT '0', - `signed_text` mediumtext NOT NULL, - `signature` text NOT NULL, - `signer` char(255) NOT NULL, - PRIMARY KEY (`id`), - KEY `iid` (`iid`), - KEY `retract_iid` (`retract_iid`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - - $r2 = q("CREATE TABLE IF NOT EXISTS `conv` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `guid` char(255) NOT NULL, - `recips` mediumtext NOT NULL, - `uid` int(11) NOT NULL, - `creator` char(255) NOT NULL, - `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', - `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', - `subject` mediumtext NOT NULL, - PRIMARY KEY (`id`), - KEY `created` (`created`), - KEY `updated` (`updated`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - - -} - -function update_r1125() { - $r = q("ALTER TABLE `profdef` ADD `field_inputs` MEDIUMTEXT NOT NULL DEFAULT ''"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - - -function update_r1126() { - $r = q("ALTER TABLE `mail` ADD `convid` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `id` , -ADD INDEX ( `convid` )"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1127() { - $r = q("ALTER TABLE `item` ADD `comments_closed` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `changed` , -ADD INDEX ( `comments_closed` ), ADD INDEX ( `changed` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1128() { - $r = q("ALTER TABLE `item` ADD `diaspora_meta` MEDIUMTEXT NOT NULL DEFAULT '' AFTER `sig` "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1129() { - $r = q("update hubloc set hubloc_network = 'zot' where hubloc_network = ''"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1130() { - $myperms = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK - |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT - |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE; - - $r = q("select abook_channel, abook_my_perms from abook where (abook_flags & %d) and abook_my_perms != 0", - intval(ABOOK_FLAG_SELF) - ); - if($r) { - foreach($r as $rr) { - set_pconfig($rr['abook_channel'],'system','autoperms',$rr['abook_my_perms']); - } - } - $r = q("update abook set abook_my_perms = %d where (abook_flags & %d) and abook_my_perms = 0", - intval($myperms), - intval(ABOOK_FLAG_SELF) - ); - - return UPDATE_SUCCESS; -} - -function update_r1131() { - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) // make sure this gets skipped for anyone who hasn't run it yet, it will fail on pg - return UPDATE_SUCCESS; - - $r1 = q("ALTER TABLE `abook` ADD `abook_rating_text` TEXT NOT NULL DEFAULT '' AFTER `abook_rating` "); - $r2 = q("ALTER TABLE `xlink` ADD `xlink_rating_text` TEXT NOT NULL DEFAULT '' AFTER `xlink_rating` "); - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1132() { - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { // correct previous failed update - $r1 = q("ALTER TABLE abook ADD abook_rating_text TEXT NOT NULL DEFAULT '' "); - $r2 = q("ALTER TABLE xlink ADD xlink_rating_text TEXT NOT NULL DEFAULT '' "); - if(!$r1 || !$r2) - return UPDATE_FAILED; - } - return UPDATE_SUCCESS; -} - -function update_r1133() { - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("CREATE TABLE xperm ( - xp_id serial NOT NULL, - xp_client varchar( 20 ) NOT NULL DEFAULT '', - xp_channel bigint NOT NULL DEFAULT '0', - xp_perm varchar( 64 ) NOT NULL DEFAULT '', - PRIMARY KEY (xp_id) )"); - $r2 = 0; - foreach(array('xp_client', 'xp_channel', 'xp_perm') as $fld) - $r2 += ((q("create index $fld on xperm ($fld)") == false) ? 0 : 1); - - $r = (($r1 && $r2) ? true : false); - } - else { - $r = q("CREATE TABLE IF NOT EXISTS `xperm` ( - `xp_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , - `xp_client` VARCHAR( 20 ) NOT NULL DEFAULT '', - `xp_channel` INT UNSIGNED NOT NULL DEFAULT '0', - `xp_perm` VARCHAR( 64 ) NOT NULL DEFAULT '', - KEY `xp_client` (`xp_client`), - KEY `xp_channel` (`xp_channel`), - KEY `xp_perm` (`xp_perm`) - ) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - } - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1134() { - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("ALTER TABLE xlink ADD xlink_static numeric(1) NOT NULL DEFAULT '0' "); - $r2 = q("create index xlink_static on xlink ( xlink_static ) "); - $r = $r1 && $r2; - } - else - $r = q("ALTER TABLE xlink ADD xlink_static TINYINT( 1 ) NOT NULL DEFAULT '0', ADD INDEX ( xlink_static ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1135() { - $r = q("ALTER TABLE xlink ADD xlink_sig TEXT NOT NULL DEFAULT ''"); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1136() { - $r1 = q("alter table item add item_unseen smallint not null default '0' "); - $r2 = q("create index item_unseen on item ( item_unseen ) "); - $r3 = q("update item set item_unseen = 1 where ( item_flags & 2 ) > 0 "); - - if($r1 && $r2 && $r3) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1137() { - $r1 = q("alter table site add site_valid smallint not null default '0' "); - $r2 = q("create index site_valid on site ( site_valid ) "); - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1138() { - $r1 = q("alter table outq add outq_priority smallint not null default '0' "); - $r2 = q("create index outq_priority on outq ( outq_priority ) "); - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1139() { - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("ALTER TABLE channel ADD channel_lastpost timestamp NOT NULL DEFAULT '0001-01-01 00:00:00'"); - $r2 = q("create index channel_lastpost on channel ( channel_lastpost ) "); - $r = $r1 && $r2; - } - else - $r = q("ALTER TABLE `channel` ADD `channel_lastpost` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `channel_dirdate` , ADD INDEX ( `channel_lastpost` ) "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1140() { - $r = q("select * from clients where true"); - $x = false; - if($r) { - foreach($r as $rr) { - $m = q("INSERT INTO xperm (xp_client, xp_channel, xp_perm) VALUES ('%s', %d, '%s') ", - dbesc($rr['client_id']), - intval($rr['uid']), - dbesc('all') - ); - if(! $m) - $x = true; - } - } - if($x) - return UPDATE_FAILED; - return UPDATE_SUCCESS; -} - - -function update_r1141() { - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("ALTER TABLE menu ADD menu_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', ADD menu_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00'"); - $r2 = q("create index menu_created on menu ( menu_created ) "); - $r3 = q("create index menu_edited on menu ( menu_edited ) "); - $r = $r1 && $r2; - } - else - $r = q("ALTER TABLE menu ADD menu_created DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD menu_edited DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( menu_created ), ADD INDEX ( menu_edited ) "); - - $t = datetime_convert(); - q("update menu set menu_created = '%s', menu_edited = '%s' where true", - dbesc($t), - dbesc($t) - ); - - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1142() { - - $r1 = q("alter table site add site_dead smallint not null default '0' "); - $r2 = q("create index site_dead on site ( site_dead ) "); - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - - -} - -function update_r1143() { - - $r1 = q("ALTER TABLE abook ADD abook_incl TEXT NOT NULL DEFAULT ''"); - $r2 = q("ALTER TABLE abook ADD abook_excl TEXT NOT NULL DEFAULT '' "); - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1144() { - $r = q("select flags, id from attach where flags != 0"); - if($r) { - foreach($r as $rr) { - if($rr['flags'] & 1) { - q("update attach set is_dir = 1 where id = %d", - intval($rr['id']) - ); - } - if($rr['flags'] & 2) { - q("update attach set os_storage = 1 where id = %d", - intval($rr['id']) - ); - } - } - } - - return UPDATE_SUCCESS; -} - -function update_r1145() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("ALTER TABLE event ADD event_status char(255) NOT NULL DEFAULT '', - ADD event_status_date timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', - ADD event_percent SMALLINT NOT NULL DEFAULT '0', - ADD event_repeat TEXT NOT NULL DEFAULT '' "); - $r2 = q("create index event_status on event ( event_status )"); - $r = $r1 && $r2; - } - else { - $r = q("ALTER TABLE `event` ADD `event_status` CHAR( 255 ) NOT NULL DEFAULT '', - ADD `event_status_date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', - ADD `event_percent` SMALLINT NOT NULL DEFAULT '0', - ADD `event_repeat` TEXT NOT NULL DEFAULT '', - ADD INDEX ( `event_status` ) "); - } - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1146() { - - $r1 = q("alter table event add event_sequence smallint not null default '0' "); - $r2 = q("create index event_sequence on event ( event_sequence ) "); - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1147() { - - $r1 = q("alter table event add event_priority smallint not null default '0' "); - $r2 = q("create index event_priority on event ( event_priority ) "); - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1148() { - $r1 = q("alter table likes add i_mid char(255) not null default '' "); - $r2 = q("create index i_mid on likes ( i_mid ) "); - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1149() { - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("ALTER TABLE obj ADD obj_term CHAR( 255 ) NOT NULL DEFAULT '', - ADD obj_url CHAR( 255 ) NOT NULL DEFAULT '', - ADD obj_imgurl CHAR( 255 ) NOT NULL DEFAULT '', - ADD obj_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', - ADD obj_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' "); - } - else { - $r1 = q("ALTER TABLE obj ADD obj_term CHAR( 255 ) NOT NULL DEFAULT '', - ADD obj_url CHAR( 255 ) NOT NULL DEFAULT '', - ADD obj_imgurl CHAR( 255 ) NOT NULL DEFAULT '', - ADD obj_created DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', - ADD obj_edited DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' "); - } - - $r2 = q("create index obj_term on obj ( obj_term ) "); - $r3 = q("create index obj_url on obj ( obj_url ) "); - $r4 = q("create index obj_imgurl on obj ( obj_imgurl ) "); - $r5 = q("create index obj_created on obj ( obj_created ) "); - $r6 = q("create index obj_edited on obj ( obj_edited ) "); - $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6; - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1150() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("ALTER TABLE app ADD app_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', - ADD app_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' "); - } - else { - $r1 = q("ALTER TABLE app ADD app_created DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', - ADD app_edited DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' "); - } - - $r2 = q("create index app_created on app ( app_created ) "); - $r3 = q("create index app_edited on app ( app_edited ) "); - - $r = $r1 && $r2 && $r3; - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1151() { - - $r3 = q("select likes.*, item.mid from likes left join item on likes.iid = item.id"); - if($r3) { - foreach($r3 as $rr) { - q("update likes set i_mid = '%s' where id = $d", - dbesc($rr['mid']), - intval($rr['id']) - ); - } - } - - - return UPDATE_SUCCESS; - -} - -function update_r1152() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - - $r1 = q("CREATE TABLE IF NOT EXISTS \"dreport\" ( - \"dreport_id\" serial NOT NULL, - \"dreport_channel\" int(11) NOT NULL DEFAULT '0', - \"dreport_mid\" char(255) NOT NULL DEFAULT '', - \"dreport_site\" char(255) NOT NULL DEFAULT '', - \"dreport_recip\" char(255) NOT NULL DEFAULT '', - \"dreport_result\" char(255) NOT NULL DEFAULT '', - \"dreport_time\" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', - \"dreport_xchan\" char(255) NOT NULL DEFAULT '', - PRIMARY KEY (\"dreport_id\") "); - - $r2 = q("create index \"dreport_mid\" on dreport (\"dreport_mid\") "); - $r3 = q("create index \"dreport_site\" on dreport (\"dreport_site\") "); - $r4 = q("create index \"dreport_time\" on dreport (\"dreport_time\") "); - $r5 = q("create index \"dreport_xchan\" on dreport (\"dreport_xchan\") "); - $r6 = q("create index \"dreport_channel\" on dreport (\"dreport_channel\") "); - - $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6; - - } - else { - $r = q("CREATE TABLE IF NOT EXISTS `dreport` ( - `dreport_id` int(11) NOT NULL AUTO_INCREMENT, - `dreport_channel` int(11) NOT NULL DEFAULT '0', - `dreport_mid` char(255) NOT NULL DEFAULT '', - `dreport_site` char(255) NOT NULL DEFAULT '', - `dreport_recip` char(255) NOT NULL DEFAULT '', - `dreport_result` char(255) NOT NULL DEFAULT '', - `dreport_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', - `dreport_xchan` char(255) NOT NULL DEFAULT '', - PRIMARY KEY (`dreport_id`), - KEY `dreport_mid` (`dreport_mid`), - KEY `dreport_site` (`dreport_site`), - KEY `dreport_time` (`dreport_time`), - KEY `dreport_xchan` (`dreport_xchan`), - KEY `dreport_channel` (`dreport_channel`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - - } - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1153() { - - $r1 = q("ALTER TABLE dreport ADD dreport_queue CHAR( 255 ) NOT NULL DEFAULT '' "); - $r2 = q("create index dreport_queue on dreport ( dreport_queue) "); - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - - -} - -function update_r1154() { - - $r = q("ALTER TABLE event ADD event_vdata text NOT NULL "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - - -function update_r1155() { - - $r1 = q("alter table site add site_type smallint not null default '0' "); - $r2 = q("create index site_type on site ( site_type ) "); - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1156() { - $r1 = q("ALTER TABLE mail ADD conv_guid CHAR( 255 ) NOT NULL DEFAULT '' "); - $r2 = q("create index conv_guid on mail ( conv_guid ) "); - - $r3 = q("select mail.id, mail.convid, conv.guid from mail left join conv on mail.convid = conv.id where true"); - if($r3) { - foreach($r3 as $rr) { - if($rr['convid']) { - q("update mail set conv_guid = '%s' where id = %d", - dbesc($rr['guid']), - intval($rr['id']) - ); - } - } - } - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1157() { - $r1 = q("alter table site add site_project char(255) not null default '' "); - $r2 = q("create index site_project on site ( site_project ) "); - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - - -function update_r1158() { - $r = q("select attach.id, attach.data, channel_address from attach left join channel on attach.uid = channel_id where os_storage = 1 and not attach.data like '%%store%%' "); - if($r) { - foreach($r as $rr) { - $has_slash = ((substr($rr['data'],0,1) === '/') ? true : false); - q("update attach set data = '%s' where id = %d", - dbesc('store/' . $rr['channel_address']. (($has_slash) ? '' : '/' . $rr['data'])), - dbesc($rr['id']) - ); - } - } - return UPDATE_SUCCESS; -} - - -function update_r1159() { - $r = q("select attach.id, attach.data, attach.hash, channel_address from attach left join channel on attach.uid = channel_id where os_storage = 1 "); - if($r) { - foreach($r as $rr) { - $x = dbunescbin($rr['data']); - $has_slash = (($x === 'store/' . $rr['channel_address'] . '/') ? true : false); - if(($x === 'store/' . $rr['channel_address']) || ($has_slash)) { - q("update attach set data = '%s' where id = %d", - dbesc('store/' . $rr['channel_address']. (($has_slash) ? '' : '/' . $rr['hash'])), - dbesc($rr['id']) - ); - } - } - } - return UPDATE_SUCCESS; -} - - -function update_r1160() { - $r = q("alter table abook add abook_instance text not null default '' "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1161() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("CREATE TABLE \"iconfig\" ( - \"id\" serial NOT NULL, - \"iid\" bigint NOT NULL DEFAULT '0', - \"cat\" text NOT NULL DEFAULT '', - \"k\" text NOT NULL DEFAULT '', - \"v\" text NOT NULL DEFAULT '', - PRIMARY_KEY(\"id\") -) "); -$r2 = q("create index \"iconfig_iid\" on iconfig (\"iid\") ");; -$r3 = q("create index \"iconfig_cat\" on iconfig (\"cat\") "); -$r4 = q("create index \"iconfig_k\" on iconfig (\"k\") "); - $r = $r1 && $r2 && $r3 && $r4; - } - else { - $r = q("CREATE TABLE IF NOT EXISTS `iconfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `iid` int(11) NOT NULL DEFAULT '0', - `cat` char(255) NOT NULL DEFAULT '', - `k` char(255) NOT NULL DEFAULT '', - `v` mediumtext NOT NULL, - PRIMARY KEY (`id`), - KEY `iid` (`iid`), - KEY `cat` (`cat`), - KEY `k` (`k`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - - } - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1162() { - $r1 = q("alter table iconfig add sharing int not null default '0' "); - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) - $r2 = q("create index \"iconfig_sharing\" on iconfig (\"sharing\") "); - else - $r2 = q("alter table iconfig add index ( sharing ) "); - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1163() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("alter table channel add channel_moved text not null default '' "); - $r2 = q("create index \"channel_channel_moved\" on channel (\"channel_moved\") "); - } - else { - $r1 = q("alter table channel add channel_moved char(255) not null default '' "); - $r2 = q("alter table channel add index ( channel_moved ) "); - } - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1164() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("CREATE TABLE \"abconfig\" ( - \"id\" serial NOT NULL, - \"chan\" text NOT NULL, - \"xchan\" text NOT NULL, - \"cat\" text NOT NULL, - \"k\" text NOT NULL, - \"v\" text NOT NULL, - PRIMARY KEY (\"id\") "); - $r2 = q("create index \"abconfig_chan\" on abconfig (\"chan\") "); - $r3 = q("create index \"abconfig_xchan\" on abconfig (\"xchan\") "); - $r4 = q("create index \"abconfig_cat\" on abconfig (\"cat\") "); - $r5 = q("create index \"abconfig_k\" on abconfig (\"k\") "); - $r = $r1 && $r2 && $r3 && $r4 && $r5; - } - else { - $r = q("CREATE TABLE IF NOT EXISTS `abconfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `chan` char(255) NOT NULL DEFAULT '', - `xchan` char(255) NOT NULL DEFAULT '', - `cat` char(255) NOT NULL DEFAULT '', - `k` char(255) NOT NULL DEFAULT '', - `v` mediumtext NOT NULL, - PRIMARY KEY (`id`), - KEY `chan` (`chan`), - KEY `xchan` (`xchan`), - KEY `cat` (`cat`), - KEY `k` (`k`) - ) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - - } - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1165() { - - $r1 = q("alter table hook add hook_version int not null default '0' "); - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) - $r2 = q("create index \"hook_version_idx\" on hook (\"hook_version\") "); - else - $r2 = q("alter table hook add index ( hook_version ) "); - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1166() { - - $r = q("alter table source add src_tag text not null default '' "); - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1167() { - - $r1 = q("alter table app add app_deleted int not null default '0' "); - $r2 = q("alter table app add app_system int not null default '0' "); - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r3 = q("create index \"app_deleted_idx\" on app (\"app_deleted\") "); - $r4 = q("create index \"app_system_idx\" on app (\"app_system\") "); - } - else { - $r3 = q("alter table app add index ( app_deleted ) "); - $r4 = q("alter table app add index ( app_system ) "); - } - - if($r1 && $r2 && $r3 && $r4) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1168() { - - $r1 = q("alter table obj add obj_quantity int not null default '0' "); - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r2 = q("create index \"obj_quantity_idx\" on obj (\"obj_quantity\") "); - } - else { - $r2 = q("alter table obj add index ( obj_quantity ) "); - } - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1169() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("ALTER TABLE `addon` CHANGE `timestamp` `tstamp` numeric( 20 ) UNSIGNED NOT NULL DEFAULT '0' "); - $r2 = q("ALTER TABLE `addon` CHANGE `name` `aname` text NOT NULL DEFAULT '' "); - $r3 = q("ALTER TABLE `hook` CHANGE `function` `fn` text NOT NULL DEFAULT '' "); - - } - else { - $r1 = q("ALTER TABLE `addon` CHANGE `timestamp` `tstamp` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0' "); - $r2 = q("ALTER TABLE `addon` CHANGE `name` `aname` CHAR(255) NOT NULL DEFAULT '' "); - $r3 = q("ALTER TABLE `hook` CHANGE `function` `fn` CHAR(255) NOT NULL DEFAULT '' "); - } - - if($r1 && $r2 && $r3) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1170() { - - $r1 = q("drop table fcontact"); - $r2 = q("drop table ffinder"); - $r3 = q("drop table fserver"); - $r4 = q("drop table fsuggest"); - $r5 = q("drop table spam"); - - if($r1 && $r2 && $r3 && $r4 && $r5) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1171() { - - $r1 = q("ALTER TABLE verify CHANGE `type` `vtype` varchar(32) NOT NULL DEFAULT '' "); - $r2 = q("ALTER TABLE tokens CHANGE `scope` `auth_scope` varchar(512) NOT NULL DEFAULT '' "); - $r3 = q("ALTER TABLE auth_codes CHANGE `scope` `auth_scope` varchar(512) NOT NULL DEFAULT '' "); - $r4 = q("ALTER TABLE clients CHANGE `name` `clname` TEXT "); - $r5 = q("ALTER TABLE session CHANGE `data` `sess_data` TEXT NOT NULL "); - $r6 = q("ALTER TABLE register CHANGE `language` `lang` varchar(16) NOT NULL DEFAULT '' "); - - if($r1 && $r2 && $r3 && $r4 && $r5 && $r6) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - - - -} - -function update_r1172() { - - $r1 = q("ALTER TABLE term CHANGE `type` `ttype` int(3) NOT NULL DEFAULT '0' "); - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r2 = q("ALTER TABLE groups CHANGE `name` `gname` TEXT NOT NULL "); - $r3 = q("ALTER TABLE profile CHANGE `name` `fullname` TEXT NOT NULL "); - $r4 = q("ALTER TABLE profile CHANGE `with` `partner` TEXT NOT NULL "); - $r5 = q("ALTER TABLE profile CHANGE `work` `employment` TEXT NOT NULL "); - } - else { - $r2 = q("ALTER TABLE groups CHANGE `name` `gname` char(255) NOT NULL DEFAULT '' "); - $r3 = q("ALTER TABLE profile CHANGE `name` `fullname` char(255) NOT NULL DEFAULT '' "); - $r4 = q("ALTER TABLE profile CHANGE `with` `partner` char(255) NOT NULL DEFAULT '' "); - $r5 = q("ALTER TABLE profile CHANGE `work` `employment` TEXT NOT NULL "); - } - if($r1 && $r2 && $r3 && $r4 && $r5) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1173() { - - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("ALTER TABLE notify CHANGE `name` `xname` TEXT NOT NULL "); - $r2 = q("ALTER TABLE notify CHANGE `date` `created` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' "); - $r3 = q("ALTER TABLE notify CHANGE `type` `ntype` numeric(3) NOT NULL DEFAULT '0' "); - } - else { - $r1 = q("ALTER TABLE notify CHANGE `name` `xname` char(255) NOT NULL DEFAULT '' "); - $r2 = q("ALTER TABLE notify CHANGE `date` `created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' "); - $r3 = q("ALTER TABLE notify CHANGE `type` `ntype` smallint(3) NOT NULL DEFAULT '0' "); - } - - if($r1 && $r2 && $r3) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1174() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("ALTER TABLE event CHANGE `type` `etype` varchar(255) NOT NULL DEFAULT '' "); - $r2 = q("ALTER TABLE event CHANGE `start` `dtstart` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' "); - $r3 = q("ALTER TABLE event CHANGE `finish` `dtend` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' "); - $r4 = q("ALTER TABLE event CHANGE `ignore` `dismissed` numeric(1) NOT NULL DEFAULT '0' "); - $r5 = q("ALTER TABLE attach CHANGE `data` `content` bytea NOT NULL "); - $r6 = q("ALTER TABLE photo CHANGE `data` `content` bytea NOT NULL "); - } - else { - $r1 = q("ALTER TABLE event CHANGE `type` `etype` char(255) NOT NULL DEFAULT '' "); - $r2 = q("ALTER TABLE event CHANGE `start` `dtstart` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' "); - $r3 = q("ALTER TABLE event CHANGE `finish` `dtend` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' "); - $r4 = q("ALTER TABLE event CHANGE `ignore` `dismissed` tinyint(1) NOT NULL DEFAULT '0' "); - $r5 = q("ALTER TABLE attach CHANGE `data` `content` longblob NOT NULL "); - $r6 = q("ALTER TABLE photo CHANGE `data` `content` mediumblob NOT NULL "); - } - - if($r1 && $r2 && $r3 && $r4 && $r5 && $r6) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1175() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("ALTER TABLE item CHANGE `object` `obj` text NOT NULL"); - $r2 = q("ALTER TABLE photo CHANGE `size` `filesize` bigint NOT NULL DEFAULT '0' "); - $r3 = q("ALTER TABLE photo CHANGE `scale` `imgscale` numeric(3) NOT NULL DEFAULT '0' "); - $r4 = q("ALTER TABLE photo CHANGE `type` `mimetype` varchar(128) NOT NULL DEFAULT 'image/jpeg' "); - - } - else { - $r1 = q("ALTER TABLE item CHANGE `object` `obj` text NOT NULL"); - $r2 = q("ALTER TABLE photo CHANGE `size` `filesize` int(10) unsigned NOT NULL DEFAULT '0' "); - $r3 = q("ALTER TABLE photo CHANGE `scale` `imgscale` tinyint(3) unsigned NOT NULL DEFAULT '0' "); - $r4 = q("ALTER TABLE photo CHANGE `type` `mimetype` char(128) NOT NULL DEFAULT 'image/jpeg' "); - - } - - if($r1 && $r2 && $r3 && $r4) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - - -function update_r1176() { - - $r = q("select * from item_id where true"); - if($r) { - foreach($r as $rr) { - \Zotlabs\Lib\IConfig::Set($rr['iid'],'system',$rr['service'],$rr['sid'],true); - } - } - return UPDATE_SUCCESS; - -} - -function update_r1177() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("alter table event add cal_id bigint NOT NULL DEFAULT '0'"); - $r2 = q("create index \"event_cal_idx\" on event (\"cal_id\") "); - - $r3 = q("CREATE TABLE \"cal\" ( - \"cal_id\" serial NOT NULL, - \"cal_aid\" bigint NOT NULL DEFAULT '0', - \"cal_uid\" bigint NOT NULL DEFAULT '0', - \"cal_hash\" text NOT NULL, - \"cal_name\" text NOT NULL, - \"uri\" text NOT NULL, - \"logname\" text NOT NULL, - \"pass\" text NOT NULL, - \"ctag\" text NOT NULL, - \"synctoken\" text NOT NULL, - \"cal_types\" text NOT NULL, - PRIMARY KEY (\"cal_id\") "); - $r4 = q("create index \"cal_hash_idx\" on cal (\"cal_hash\") "); - $r5 = q("create index \"cal_name_idx\" on cal (\"cal_name\") "); - $r6 = q("create index \"cal_types_idx\" on cal (\"cal_types\") "); - $r7 = q("create index \"cal_aid_idx\" on cal (\"cal_aid\") "); - $r8 = q("create index \"cal_uid_idx\" on cal (\"cal_uid\") "); - $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6 && $r7 && $r8; - } - else { - $r1 = q("alter table event add cal_id int(10) unsigned NOT NULL DEFAULT '0', - add index ( cal_id ) "); - - $r2 = q("CREATE TABLE IF NOT EXISTS `cal` ( - `cal_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `cal_aid` int(10) unsigned NOT NULL DEFAULT '0', - `cal_uid` int(10) unsigned NOT NULL DEFAULT '0', - `cal_hash` varchar(255) NOT NULL DEFAULT '', - `cal_name` varchar(255) NOT NULL DEFAULT '', - `uri` varchar(255) NOT NULL DEFAULT '', - `logname` varchar(255) NOT NULL DEFAULT '', - `pass` varchar(255) NOT NULL DEFAULT '', - `ctag` varchar(255) NOT NULL DEFAULT '', - `synctoken` varchar(255) NOT NULL DEFAULT '', - `cal_types` varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (`cal_id`), - KEY `cal_aid` (`cal_aid`), - KEY `cal_uid` (`cal_uid`), - KEY `cal_hash` (`cal_hash`), - KEY `cal_name` (`cal_name`), - KEY `cal_types` (`cal_types`) - ) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - - $r = $r1 && $r2; - } - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1178() { - - $c2 = null; - - $c1 = q("SELECT channel_id, channel_hash from channel where true"); - if($c1) { - $c2 = q("SELECT id, chan from abconfig where true"); - if($c2) { - for($x = 0; $x < count($c2); $x ++) { - foreach($c1 as $c) { - if($c['channel_hash'] == $c2[$x]['chan']) { - $c2[$x]['chan'] = $c['channel_id']; - break; - } - } - } - } - } - - $r1 = q("ALTER TABLE abconfig CHANGE chan chan int(10) unsigned NOT NULL DEFAULT '0' "); - - if($c2) { - foreach($c2 as $c) { - q("UPDATE abconfig SET chan = %d where id = %d", - intval($c['chan']), - intval($c['id']) - ); - } - } - - if($r1) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1179() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("CREATE TABLE atoken ( - atoken_id serial NOT NULL, - atoken_aid bigint NOT NULL DEFAULT 0, - atoken_uid bigint NOT NULL DEFAULT 0, - atoken_name varchar(255) NOT NULL DEFAULT '', - atoken_token varchar(255) NOT NULL DEFAULT '', - atoken_expires timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', - PRIMARY KEY (atoken_id)) "); - $r2 = q("create index atoken_aid on atoken (atoken_aid)"); - $r3 = q("create index atoken_uid on atoken (atoken_uid)"); - $r4 = q("create index atoken_name on atoken (atoken_name)"); - $r5 = q("create index atoken_token on atoken (atoken_token)"); - $r6 = q("create index atoken_expires on atoken (atoken_expires)"); - - $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6; - - } - else { - $r = q("CREATE TABLE IF NOT EXISTS `atoken` ( - `atoken_id` int(11) NOT NULL AUTO_INCREMENT, - `atoken_aid` int(11) NOT NULL DEFAULT 0, - `atoken_uid` int(11) NOT NULL DEFAULT 0, - `atoken_name` char(255) NOT NULL DEFAULT '', - `atoken_token` char(255) NOT NULL DEFAULT '', - `atoken_expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', - PRIMARY KEY (`atoken_id`), - KEY `atoken_aid` (`atoken_aid`), - KEY `atoken_uid` (`atoken_uid`), - KEY `atoken_name` (`atoken_name`), - KEY `atoken_token` (`atoken_token`), - KEY `atoken_expires` (`atoken_expires`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); - } - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1180() { - - require_once('include/perm_upgrade.php'); - - $r1 = q("select * from channel where true"); - if($r1) { - foreach($r1 as $rr) { - perm_limits_upgrade($rr); - autoperms_upgrade($rr); - } - } - - $r2 = q("select * from abook where true"); - if($r2) { - foreach($r2 as $rr) { - perm_abook_upgrade($rr); - } - } - - $r = $r1 && $r2; - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1181() { - if(\Zotlabs\Lib\System::get_server_role() == 'pro') { - q("update account set account_level = 5 where true"); - } - return UPDATE_SUCCESS; -} - -function update_r1182() { - - $r1 = q("alter table site add site_version varchar(32) not null default '' "); - - if($r1) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1183() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("alter table hook ALTER COLUMN priority TYPE smallint"); - $r2 = q("alter table hook ALTER COLUMN priority SET NOT NULL"); - $r3 = q("alter table hook ALTER COLUMN priority SET DEFAULT '0'"); - $r1 = $r1 && $r2 && $r3; - } - else { - $r1 = q("alter table hook CHANGE priority priority smallint NOT NULL DEFAULT '0' "); - } - $r2 = q("create index priority_idx on hook (priority)"); - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1184() { - - $r1 = q("alter table site add site_crypto text not null default '' "); - - if($r1) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1185() { - - $r1 = q("alter table app add app_plugin text not null default '' "); - - if($r1) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1186() { - - $r1 = q("alter table profile add profile_vcard text not null"); - - if($r1) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - - -} - -function update_r1187() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("alter table outq add outq_scheduled timestamp not null default '0001-01-01 00:00:00' "); - } - else { - $r1 = q("alter table outq add outq_scheduled datetime not null default '0001-01-01 00:00:00' "); - } - $r2 = q("create index outq_scheduled_idx on outq (outq_scheduled)"); - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - - -} - -function update_r1188() { - - $r1 = q("alter table channel add channel_password varchar(255) not null default '' "); - $r2 = q("alter table channel add channel_salt varchar(255) not null default '' "); - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1189() { - - $r1 = q("alter table mail add mail_mimetype varchar(64) not null default 'text/bbcode' "); - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r2 = q("alter table mail add mail_raw smallint not null default 0 "); - } - else { - $r2 = q("alter table mail add mail_raw tinyint(4) not null default 0 "); - } - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - -} - -function update_r1190() { - $r1 = q("alter table abook add abook_not_here smallint not null default 0 "); - - $r2 = q("create index abook_not_here on abook (abook_not_here)"); - - if($r1 && $r2) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1191() { - - $r = q("SELECT 1 FROM principals LIMIT 1"); - - if($r !== false) { - return UPDATE_SUCCESS; - } - else { - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("CREATE TABLE addressbooks ( - id SERIAL NOT NULL, - principaluri VARCHAR(255), - displayname VARCHAR(255), - uri VARCHAR(200), - description TEXT, - synctoken INTEGER NOT NULL DEFAULT 1 - );" - ); - - $r2 = q("ALTER TABLE ONLY addressbooks ADD CONSTRAINT addressbooks_pkey PRIMARY KEY (id);"); - - $r3 = q("CREATE UNIQUE INDEX addressbooks_ukey ON addressbooks USING btree (principaluri, uri);"); - - $r4 = q("CREATE TABLE cards ( - id SERIAL NOT NULL, - addressbookid INTEGER NOT NULL, - carddata BYTEA, - uri VARCHAR(200), - lastmodified INTEGER, - etag VARCHAR(32), - size INTEGER NOT NULL - );" - ); - - $r5 = q("ALTER TABLE ONLY cards ADD CONSTRAINT cards_pkey PRIMARY KEY (id);"); - - $r6 = q("CREATE UNIQUE INDEX cards_ukey ON cards USING btree (addressbookid, uri);"); - - $r7 = q("CREATE TABLE addressbookchanges ( - id SERIAL NOT NULL, - uri VARCHAR(200) NOT NULL, - synctoken INTEGER NOT NULL, - addressbookid INTEGER NOT NULL, - operation SMALLINT NOT NULL - );" - ); - - $r8 = q("ALTER TABLE ONLY addressbookchanges ADD CONSTRAINT addressbookchanges_pkey PRIMARY KEY (id);"); - - $r9 = q("CREATE INDEX addressbookchanges_addressbookid_synctoken_ix ON addressbookchanges USING btree (addressbookid, synctoken);"); - - $r10 = q("CREATE TABLE calendarobjects ( - id SERIAL NOT NULL, - calendardata BYTEA, - uri VARCHAR(200), - calendarid INTEGER NOT NULL, - lastmodified INTEGER, - etag VARCHAR(32), - size INTEGER NOT NULL, - componenttype VARCHAR(8), - firstoccurence INTEGER, - lastoccurence INTEGER, - uid VARCHAR(200) - );" - ); - - $r11 = q("ALTER TABLE ONLY calendarobjects ADD CONSTRAINT calendarobjects_pkey PRIMARY KEY (id);"); - - $r12 = q("CREATE UNIQUE INDEX calendarobjects_ukey ON calendarobjects USING btree (calendarid, uri);"); - - $r13 = q("CREATE TABLE calendars ( - id SERIAL NOT NULL, - synctoken INTEGER NOT NULL DEFAULT 1, - components VARCHAR(21) - );" - ); - - $r14 = q("ALTER TABLE ONLY calendars ADD CONSTRAINT calendars_pkey PRIMARY KEY (id);"); - - $r15 = q("CREATE TABLE calendarinstances ( - id SERIAL NOT NULL, - calendarid INTEGER NOT NULL, - principaluri VARCHAR(100), - access SMALLINT NOT NULL DEFAULT '1', -- '1 = owner, 2 = read, 3 = readwrite' - displayname VARCHAR(100), - uri VARCHAR(200), - description TEXT, - calendarorder INTEGER NOT NULL DEFAULT 0, - calendarcolor VARCHAR(10), - timezone TEXT, - transparent SMALLINT NOT NULL DEFAULT '0', - share_href VARCHAR(100), - share_displayname VARCHAR(100), - share_invitestatus SMALLINT NOT NULL DEFAULT '2' -- '1 = noresponse, 2 = accepted, 3 = declined, 4 = invalid' - );" - ); - - $r16 = q("ALTER TABLE ONLY calendarinstances ADD CONSTRAINT calendarinstances_pkey PRIMARY KEY (id);"); - - $r17 = q("CREATE UNIQUE INDEX calendarinstances_principaluri_uri ON calendarinstances USING btree (principaluri, uri);"); - - $r18 = q("CREATE UNIQUE INDEX calendarinstances_principaluri_calendarid ON calendarinstances USING btree (principaluri, calendarid);"); - - $r19 = q("CREATE UNIQUE INDEX calendarinstances_principaluri_share_href ON calendarinstances USING btree (principaluri, share_href);"); - - $r20 = q("CREATE TABLE calendarsubscriptions ( - id SERIAL NOT NULL, - uri VARCHAR(200) NOT NULL, - principaluri VARCHAR(100) NOT NULL, - source TEXT, - displayname VARCHAR(100), - refreshrate VARCHAR(10), - calendarorder INTEGER NOT NULL DEFAULT 0, - calendarcolor VARCHAR(10), - striptodos SMALLINT NULL, - stripalarms SMALLINT NULL, - stripattachments SMALLINT NULL, - lastmodified INTEGER - );" - ); - - $r21 = q("ALTER TABLE ONLY calendarsubscriptions ADD CONSTRAINT calendarsubscriptions_pkey PRIMARY KEY (id);"); - - $r22 = q("CREATE UNIQUE INDEX calendarsubscriptions_ukey ON calendarsubscriptions USING btree (principaluri, uri);"); - - $r23 = q("CREATE TABLE calendarchanges ( - id SERIAL NOT NULL, - uri VARCHAR(200) NOT NULL, - synctoken INTEGER NOT NULL, - calendarid INTEGER NOT NULL, - operation SMALLINT NOT NULL DEFAULT 0 - );" - ); - - $r24 = q("ALTER TABLE ONLY calendarchanges ADD CONSTRAINT calendarchanges_pkey PRIMARY KEY (id);"); - - $r25 = q("CREATE INDEX calendarchanges_calendarid_synctoken_ix ON calendarchanges USING btree (calendarid, synctoken);"); - - $r26 = q("CREATE TABLE schedulingobjects ( - id SERIAL NOT NULL, - principaluri VARCHAR(255), - calendardata BYTEA, - uri VARCHAR(200), - lastmodified INTEGER, - etag VARCHAR(32), - size INTEGER NOT NULL - );" - ); - - $r27 = q("CREATE TABLE locks ( - id SERIAL NOT NULL, - owner VARCHAR(100), - timeout INTEGER, - created INTEGER, - token VARCHAR(100), - scope SMALLINT, - depth SMALLINT, - uri TEXT - );" - ); - - $r28 = q("ALTER TABLE ONLY locks ADD CONSTRAINT locks_pkey PRIMARY KEY (id);"); - - $r29 = q("CREATE INDEX locks_token_ix ON locks USING btree (token);"); - - $r30 = q("CREATE INDEX locks_uri_ix ON locks USING btree (uri);"); - - $r31 = q("CREATE TABLE principals ( - id SERIAL NOT NULL, - uri VARCHAR(200) NOT NULL, - email VARCHAR(80), - displayname VARCHAR(80) - );" - ); - - $r32 = q("ALTER TABLE ONLY principals ADD CONSTRAINT principals_pkey PRIMARY KEY (id);"); - - $r33 = q("CREATE UNIQUE INDEX principals_ukey ON principals USING btree (uri);"); - - $r34 = q("CREATE TABLE groupmembers ( - id SERIAL NOT NULL, - principal_id INTEGER NOT NULL, - member_id INTEGER NOT NULL - );" - ); - - $r35 = q("ALTER TABLE ONLY groupmembers ADD CONSTRAINT groupmembers_pkey PRIMARY KEY (id);"); - - $r36 = q("CREATE UNIQUE INDEX groupmembers_ukey ON groupmembers USING btree (principal_id, member_id);"); - - $r37 = q("CREATE TABLE propertystorage ( - id SERIAL NOT NULL, - path VARCHAR(1024) NOT NULL, - name VARCHAR(100) NOT NULL, - valuetype INT, - value BYTEA - );" - ); - - $r38 = q("ALTER TABLE ONLY propertystorage ADD CONSTRAINT propertystorage_pkey PRIMARY KEY (id);"); - - $r39 = q("CREATE UNIQUE INDEX propertystorage_ukey ON propertystorage (path, name);"); - - $r40 = q("CREATE TABLE users ( - id SERIAL NOT NULL, - username VARCHAR(50), - digesta1 VARCHAR(32) - );" - ); - - $r41 = q("ALTER TABLE ONLY users ADD CONSTRAINT users_pkey PRIMARY KEY (id);"); - - $r42 = q("CREATE UNIQUE INDEX users_ukey ON users USING btree (username);"); - - if( - $r1 && $r2 && $r3 && $r4 && $r5 && $r6 && $r7 && $r8 && $r9 && $r10 - && $r11 && $r12 && $r13 && $r14 && $r15 && $r16 && $r17 && $r18 && $r19 && $r20 - && $r21 && $r22 && $r23 && $r24 && $r25 && $r26 && $r27 && $r28 && $r29 && $r30 - && $r31 && $r32 && $r33 && $r34 && $r35 && $r36 && $r37 && $r38 && $r39 && $r40 - && $r41 && $r42 - ) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - } - else { - $r1 = q("CREATE TABLE if not exists addressbooks ( - id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - principaluri VARBINARY(255), - displayname VARCHAR(255), - uri VARBINARY(200), - description TEXT, - synctoken INT(11) UNSIGNED NOT NULL DEFAULT '1', - UNIQUE(principaluri(100), uri(100)) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" - ); - - $r2 = q("CREATE TABLE if not exists cards ( - id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - addressbookid INT(11) UNSIGNED NOT NULL, - carddata MEDIUMBLOB, - uri VARBINARY(200), - lastmodified INT(11) UNSIGNED, - etag VARBINARY(32), - size INT(11) UNSIGNED NOT NULL - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" - ); - - $r3 = q("CREATE TABLE if not exists addressbookchanges ( - id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - uri VARBINARY(200) NOT NULL, - synctoken INT(11) UNSIGNED NOT NULL, - addressbookid INT(11) UNSIGNED NOT NULL, - operation TINYINT(1) NOT NULL, - INDEX addressbookid_synctoken (addressbookid, synctoken) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" - ); - - $r4 = q("CREATE TABLE if not exists calendarobjects ( - id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - calendardata MEDIUMBLOB, - uri VARBINARY(200), - calendarid INTEGER UNSIGNED NOT NULL, - lastmodified INT(11) UNSIGNED, - etag VARBINARY(32), - size INT(11) UNSIGNED NOT NULL, - componenttype VARBINARY(8), - firstoccurence INT(11) UNSIGNED, - lastoccurence INT(11) UNSIGNED, - uid VARBINARY(200), - UNIQUE(calendarid, uri), - INDEX calendarid_time (calendarid, firstoccurence) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" - ); - - $r5 = q("CREATE TABLE if not exists calendars ( - id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - synctoken INTEGER UNSIGNED NOT NULL DEFAULT '1', - components VARBINARY(21) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" - ); - - $r6 = q("CREATE TABLE if not exists calendarinstances ( - id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - calendarid INTEGER UNSIGNED NOT NULL, - principaluri VARBINARY(100), - access TINYINT(1) NOT NULL DEFAULT '1' COMMENT '1 = owner, 2 = read, 3 = readwrite', - displayname VARCHAR(100), - uri VARBINARY(200), - description TEXT, - calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0', - calendarcolor VARBINARY(10), - timezone TEXT, - transparent TINYINT(1) NOT NULL DEFAULT '0', - share_href VARBINARY(100), - share_displayname VARCHAR(100), - share_invitestatus TINYINT(1) NOT NULL DEFAULT '2' COMMENT '1 = noresponse, 2 = accepted, 3 = declined, 4 = invalid', - UNIQUE(principaluri, uri), - UNIQUE(calendarid, principaluri), - UNIQUE(calendarid, share_href) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" - ); - - $r7 = q("CREATE TABLE if not exists calendarchanges ( - id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - uri VARBINARY(200) NOT NULL, - synctoken INT(11) UNSIGNED NOT NULL, - calendarid INT(11) UNSIGNED NOT NULL, - operation TINYINT(1) NOT NULL, - INDEX calendarid_synctoken (calendarid, synctoken) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" - ); - - $r8 = q("CREATE TABLE if not exists calendarsubscriptions ( - id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - uri VARBINARY(200) NOT NULL, - principaluri VARBINARY(100) NOT NULL, - source TEXT, - displayname VARCHAR(100), - refreshrate VARCHAR(10), - calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0', - calendarcolor VARBINARY(10), - striptodos TINYINT(1) NULL, - stripalarms TINYINT(1) NULL, - stripattachments TINYINT(1) NULL, - lastmodified INT(11) UNSIGNED, - UNIQUE(principaluri, uri) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" - ); - - $r9 = q("CREATE TABLE if not exists schedulingobjects ( - id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - principaluri VARBINARY(255), - calendardata MEDIUMBLOB, - uri VARBINARY(200), - lastmodified INT(11) UNSIGNED, - etag VARBINARY(32), - size INT(11) UNSIGNED NOT NULL - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" - ); - - $r10 = q("CREATE TABLE if not exists locks ( - id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - owner VARCHAR(100), - timeout INTEGER UNSIGNED, - created INTEGER, - token VARBINARY(100), - scope TINYINT, - depth TINYINT, - uri VARBINARY(1000), - INDEX(token), - INDEX(uri(100)) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" - ); - - $r11 = q("CREATE TABLE if not exists principals ( - id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - uri VARBINARY(200) NOT NULL, - email VARBINARY(80), - displayname VARCHAR(80), - UNIQUE(uri) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" - ); - - $r12 = q("CREATE TABLE if not exists groupmembers ( - id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - principal_id INTEGER UNSIGNED NOT NULL, - member_id INTEGER UNSIGNED NOT NULL, - UNIQUE(principal_id, member_id) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" - ); - - $r13 = q("CREATE TABLE if not exists propertystorage ( - id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - path VARBINARY(1024) NOT NULL, - name VARBINARY(100) NOT NULL, - valuetype INT UNSIGNED, - value MEDIUMBLOB - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" - ); - - $r14 = q("CREATE UNIQUE INDEX path_property ON propertystorage (path(600), name(100));"); - - $r15 = q("CREATE TABLE if not exists users ( - id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - username VARBINARY(50), - digesta1 VARBINARY(32), - UNIQUE(username) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" - ); - - $r16 = q("CREATE TABLE if not exists calendarinstances ( - id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - calendarid INTEGER UNSIGNED NOT NULL, - principaluri VARBINARY(100), - access TINYINT(1) NOT NULL DEFAULT '1' COMMENT '1 = owner, 2 = read, 3 = readwrite', - displayname VARCHAR(100), - uri VARBINARY(200), - description TEXT, - calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0', - calendarcolor VARBINARY(10), - timezone TEXT, - transparent TINYINT(1) NOT NULL DEFAULT '0', - share_href VARBINARY(100), - share_displayname VARCHAR(100), - share_invitestatus TINYINT(1) NOT NULL DEFAULT '2' COMMENT '1 = noresponse, 2 = accepted, 3 = declined, 4 = invalid', - UNIQUE(principaluri, uri), - UNIQUE(calendarid, principaluri), - UNIQUE(calendarid, share_href) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" - ); - - if($r1 && $r2 && $r3 && $r4 && $r5 && $r6 && $r7 && $r8 && $r9 && $r10 && $r11 && $r12 && $r13 && $r14 && $r15 && $r16) - return UPDATE_SUCCESS; - return UPDATE_FAILED; - } - } -} - -function update_r1192() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("CREATE INDEX item_obj_type ON item (obj_type)"); - } - else { - $r1 = q("ALTER TABLE item ADD INDEX (obj_type)"); - } - - if($r1) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1193() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("CREATE INDEX item_uid_unseen ON item (uid, item_unseen)"); - } - else { - $r1 = q("ALTER TABLE item ADD INDEX uid_item_unseen (uid, item_unseen)"); - } - - if($r1) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - - -function update_r1194() { - $r = q("select id, resource_id from item where resource_type = 'nwiki'"); - if($r) { - foreach($r as $rv) { - $mimetype = get_iconfig($rv['id'],'wiki','mimeType'); - q("update item set mimetype = '%s' where resource_type = 'nwikipage' and resource_id = '%s'", - dbesc($mimetype), - dbesc($rv['resource_id']) - ); - } - } - - return UPDATE_SUCCESS; -} - -function update_r1195() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("CREATE INDEX item_resource_id ON item (resource_id)"); - } - else { - $r1 = q("ALTER TABLE item ADD INDEX (resource_id)"); - } - - if($r1) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} - -function update_r1196() { - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("CREATE TABLE \"pchan\" ( - \"pchan_id\" serial NOT NULL, - \"pchan_guid\" text NOT NULL, - \"pchan_hash\" text NOT NULL, - \"pchan_pubkey\" text NOT NULL, - \"pchan_prvkey\" text NOT NULL, - PRIMARY KEY (\"pchan_id\") -)"); - - $r2 = q("create index \"pchan_guid\" on pchan (\"pchan_guid\")"); - $r3 = q("create index \"pchan_hash\" on pchan (\"pchan_hash\")"); - - if($r1 && $r2 && $r3) { - return UPDATE_SUCCESS; - } - } - else { - $r1 = q("CREATE TABLE IF NOT EXISTS pchan ( - pchan_id int(11) UNSIGNED NOT NULL AUTO_INCREMENT, - pchan_guid char(191) NOT NULL DEFAULT '', - pchan_hash char(191) NOT NULL DEFAULT '', - pchan_pubkey text NOT NULL, - pchan_prvkey text NOT NULL, - PRIMARY KEY (pchan_id), - KEY pchan_guid (pchan_guid), - KEY pchan_hash (pchan_hash) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4"); - if($r1) { - return UPDATE_SUCCESS; - } - } - - return UPDATE_FAILED; -} - -function update_r1197() { - - $r = q("select diaspora_meta from item where true limit 1"); - if($r) { - $r = q("ALTER TABLE item DROP diaspora_meta"); - } - - return UPDATE_SUCCESS; -} - -function update_r1198() { - - if(ACTIVE_DBTYPE == DBTYPE_MYSQL) { - $r = q("ALTER TABLE item - DROP INDEX item_blocked, - DROP INDEX item_unpublished, - DROP INDEX item_deleted, - DROP INDEX item_delayed, - DROP INDEX item_hidden, - DROP INDEX item_pending_remove, - DROP INDEX item_type - "); - } - - return UPDATE_SUCCESS; -} - -function update_r1199() { - - if(ACTIVE_DBTYPE == DBTYPE_MYSQL) { - $r = q("ALTER TABLE item - DROP INDEX uid, - ADD INDEX (item_type) - "); - } - - return UPDATE_SUCCESS; -} - -function update_r1200() { - - if(ACTIVE_DBTYPE == DBTYPE_MYSQL) { - $r = q("ALTER TABLE item - DROP INDEX item_type, - ADD INDEX uid_item_type (uid, item_type) - "); - } - - if($r) - return UPDATE_SUCCESS; - return UPDATE_FAILED; -} |