mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 21:35:13 +00:00
add photo.expires
This commit is contained in:
parent
2db3efddf5
commit
c4824f6fd5
5 changed files with 40 additions and 1 deletions
32
Zotlabs/Update/_1232.php
Normal file
32
Zotlabs/Update/_1232.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Zotlabs\Update;
|
||||
|
||||
class _1232 {
|
||||
|
||||
function run() {
|
||||
|
||||
q("START TRANSACTION");
|
||||
|
||||
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
|
||||
$r1 = q("ALTER TABLE photo ADD expires timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
|
||||
$r2 = q("create index \"photo_expires_idx\" on photo (\"expires\")");
|
||||
|
||||
$r = ($r1 && $r2);
|
||||
}
|
||||
else {
|
||||
$r = q("ALTER TABLE `photo` ADD `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' ,
|
||||
ADD INDEX `expires` (`expires`)");
|
||||
}
|
||||
|
||||
if($r) {
|
||||
q("COMMIT");
|
||||
return UPDATE_SUCCESS;
|
||||
}
|
||||
|
||||
q("ROLLBACK");
|
||||
return UPDATE_FAILED;
|
||||
|
||||
}
|
||||
|
||||
}
|
2
boot.php
2
boot.php
|
@ -44,7 +44,7 @@ require_once('include/items.php');
|
|||
define ( 'STD_VERSION', '2.11' );
|
||||
define ( 'ZOT_REVISION', '6.0' );
|
||||
|
||||
define ( 'DB_UPDATE_VERSION', 1231 );
|
||||
define ( 'DB_UPDATE_VERSION', 1232 );
|
||||
|
||||
define ( 'PROJECT_BASE', __DIR__ );
|
||||
|
||||
|
|
|
@ -352,6 +352,7 @@ abstract class photo_driver {
|
|||
$p['deny_gid'] = (($arr['deny_gid']) ? $arr['deny_gid'] : '');
|
||||
$p['created'] = (($arr['created']) ? $arr['created'] : datetime_convert());
|
||||
$p['edited'] = (($arr['edited']) ? $arr['edited'] : $p['created']);
|
||||
$p['expires'] = (($arr['expires']) ? $arr['expires'] : NULL_DATE);
|
||||
$p['title'] = (($arr['title']) ? $arr['title'] : '');
|
||||
$p['description'] = (($arr['description']) ? $arr['description'] : '');
|
||||
$p['photo_usage'] = intval($arr['photo_usage']);
|
||||
|
@ -379,6 +380,7 @@ abstract class photo_driver {
|
|||
resource_id = '%s',
|
||||
created = '%s',
|
||||
edited = '%s',
|
||||
expires = '%s',
|
||||
filename = '%s',
|
||||
mimetype = '%s',
|
||||
album = '%s',
|
||||
|
@ -405,6 +407,7 @@ abstract class photo_driver {
|
|||
dbesc($p['resource_id']),
|
||||
dbesc($p['created']),
|
||||
dbesc($p['edited']),
|
||||
dbesc($p['expires']),
|
||||
dbesc(basename($p['filename'])),
|
||||
dbesc($this->getType()),
|
||||
dbesc($p['album']),
|
||||
|
|
|
@ -922,6 +922,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
|
|||
`resource_id` char(191) NOT NULL DEFAULT '',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
`title` char(191) NOT NULL DEFAULT '',
|
||||
`description` text NOT NULL,
|
||||
`album` char(191) NOT NULL DEFAULT '',
|
||||
|
@ -948,6 +949,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
|
|||
KEY `album` (`album`),
|
||||
KEY `imgscale` (`imgscale`),
|
||||
KEY `profile` (`profile`),
|
||||
KEY `expires` (`expires`),
|
||||
KEY `photo_flags` (`photo_flags`),
|
||||
KEY `mimetype` (`mimetype`),
|
||||
KEY `aid` (`aid`),
|
||||
|
|
|
@ -919,6 +919,7 @@ CREATE TABLE "photo" (
|
|||
"resource_id" text NOT NULL,
|
||||
"created" timestamp NOT NULL,
|
||||
"edited" timestamp NOT NULL,
|
||||
"expires" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
"title" text NOT NULL,
|
||||
"description" text NOT NULL,
|
||||
"album" text NOT NULL,
|
||||
|
@ -949,6 +950,7 @@ create index "photo_profile" on photo ("profile");
|
|||
create index "photo_flags" on photo ("photo_flags");
|
||||
create index "photo_mimetype" on photo ("mimetype");
|
||||
create index "photo_aid" on photo ("aid");
|
||||
create index "photo_expires" on photo ("expires");
|
||||
create index "photo_xchan" on photo ("xchan");
|
||||
create index "photo_filesize" on photo ("filesize");
|
||||
create index "photo_resource_id" on photo ("resource_id");
|
||||
|
|
Loading…
Reference in a new issue