diff options
author | Friendika <info@friendika.com> | 2011-09-18 19:04:11 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-09-18 19:04:11 -0700 |
commit | 8bf6a29d4e05af5d461da3f01999785dc12ee7da (patch) | |
tree | e8d52eee1c8f60fda836edebd685726be930d946 /update.php | |
parent | e2e29b2deafffb98d156fb3f726a3968b3492522 (diff) | |
download | volse-hubzilla-8bf6a29d4e05af5d461da3f01999785dc12ee7da.tar.gz volse-hubzilla-8bf6a29d4e05af5d461da3f01999785dc12ee7da.tar.bz2 volse-hubzilla-8bf6a29d4e05af5d461da3f01999785dc12ee7da.zip |
optimise the commented date view
Diffstat (limited to 'update.php')
-rw-r--r-- | update.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/update.php b/update.php index f94e78d72..82ae05872 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1087 ); +define( 'UPDATE_VERSION' , 1088 ); /** * @@ -726,3 +726,20 @@ function update_1086() { q("ALTER TABLE `item` ADD `bookmark` tinyint(1) NOT NULL DEFAULT '0' AFTER `starred` "); } +function update_1087() { + q("ALTER TABLE `item` ADD `commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `edited` "); + + $r = q("SELECT `id` FROM `item` WHERE `parent` = `id` "); + if(count($r)) { + foreach($r as $rr) { + $x = q("SELECT max(`created`) AS `cdate` FROM `item` WHERE `parent` = %d LIMIT 1", + intval($rr['id']) + ); + if(count($x)) + q("UPDATE `item` SET `commented` = '%s' WHERE `id` = %d LIMIT 1", + dbesc($x[0]['cdate']), + intval($rr['id']) + ); + } + } +} |