Pages with differents dates after installation

This commit is contained in:
Diego Najar 2019-02-02 16:14:00 +01:00
parent 088179f1fb
commit 785965db35
2 changed files with 12 additions and 1 deletions

View File

@ -47,6 +47,15 @@ class Date {
return self::translate($output); return self::translate($output);
} }
public static function offset($date, $format, $offset)
{
$Date = new DateTime($date);
$Date->modify($offset);
$output = $Date->format($format);
return self::translate($output);
}
// Format a local time/date according to locale settings. // Format a local time/date according to locale settings.
public static function format($date, $currentFormat, $outputFormat) public static function format($date, $currentFormat, $outputFormat)
{ {

View File

@ -319,11 +319,13 @@ function install($adminPassword, $timezone)
$data = array(); $data = array();
$slugs = array(); $slugs = array();
$nextDate = $currentDate;
foreach ($pagesToInstall as $page) { foreach ($pagesToInstall as $page) {
$slug = $page; $slug = $page;
$title = Text::replace('slug','title', $slug); $title = Text::replace('slug','title', $slug);
$content = Text::replace('slug','content', $slug); $content = Text::replace('slug','content', $slug);
$nextDate = Date::offset($nextDate, DB_DATE_FORMAT, '-1 minute');
$data[$L->get($slug)]= array( $data[$L->get($slug)]= array(
'title'=>$L->get($title), 'title'=>$L->get($title),
@ -331,7 +333,7 @@ function install($adminPassword, $timezone)
'username'=>'admin', 'username'=>'admin',
'tags'=>array(), 'tags'=>array(),
'type'=>(($slug=='example-page-4-slug')?'static':'published'), 'type'=>(($slug=='example-page-4-slug')?'static':'published'),
'date'=>$currentDate, 'date'=>$nextDate,
'dateModified'=>'', 'dateModified'=>'',
'allowComments'=>true, 'allowComments'=>true,
'position'=>1, 'position'=>1,