mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
// +-----------------------------------------------------------------------+
|
|
// | This file is part of Piwigo. |
|
|
// | |
|
|
// | For copyright and license information, please view the COPYING.txt |
|
|
// | file that was distributed with this source code. |
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
if (!defined('PHPWG_ROOT_PATH'))
|
|
{
|
|
die('Hacking attempt!');
|
|
}
|
|
|
|
$upgrade_description = 'Update column save author_id with value.';
|
|
|
|
$query = '
|
|
UPDATE
|
|
'.COMMENTS_TABLE.' AS c ,
|
|
'.USERS_TABLE.' AS u,
|
|
'.USER_INFOS_TABLE.' AS i
|
|
SET c.author_id = u.'.$conf['user_fields']['id'].'
|
|
WHERE
|
|
c.author_id is null
|
|
AND c.author = u.'.$conf['user_fields']['username'].'
|
|
AND u.'.$conf['user_fields']['id'].' = i.user_id
|
|
AND i.registration_date <= c.date
|
|
;';
|
|
|
|
pwg_query($query);
|
|
|
|
$query = '
|
|
UPDATE '.COMMENTS_TABLE.' AS c
|
|
SET c.author_id = '.$conf['guest_id'].'
|
|
WHERE c.author_id is null
|
|
;';
|
|
|
|
pwg_query($query);
|
|
|
|
echo
|
|
"\n"
|
|
. $upgrade_description
|
|
."\n"
|
|
;
|
|
?>
|