/**
  * @param Schema $schema
  * @return void
  */
 public function up(Schema $schema)
 {
     $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
     $now = new Now();
     $default = $now->format($this->platform->getDateTimeFormatString());
     $this->addSql("ALTER TABLE typo3_typo3cr_domain_model_nodedata ADD creationdatetime DATETIME NOT NULL, ADD lastmodificationdatetime DATETIME NOT NULL, ADD lastpublicationdatetime DATETIME DEFAULT NULL");
     $this->addSql("UPDATE typo3_typo3cr_domain_model_nodedata SET creationdatetime = '" . $default . "', lastmodificationdatetime = '" . $default . "'");
     $this->addSql("UPDATE typo3_typo3cr_domain_model_nodedata SET lastpublicationdatetime = '" . $default . "' WHERE workspace = 'live'");
 }
 /**
  * @param Schema $schema
  * @return void
  */
 public function up(Schema $schema)
 {
     $this->abortIf($this->connection->getDatabasePlatform()->getName() != "postgresql");
     $now = new Now();
     $default = $now->format($this->platform->getDateTimeFormatString());
     $this->addSql("ALTER TABLE typo3_typo3cr_domain_model_nodedata ADD creationdatetime TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL DEFAULT '" . $default . "'");
     $this->addSql("ALTER TABLE typo3_typo3cr_domain_model_nodedata ALTER COLUMN creationdatetime DROP DEFAULT");
     $this->addSql("ALTER TABLE typo3_typo3cr_domain_model_nodedata ADD lastmodificationdatetime TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL DEFAULT '" . $default . "'");
     $this->addSql("ALTER TABLE typo3_typo3cr_domain_model_nodedata ALTER COLUMN lastmodificationdatetime DROP DEFAULT");
     $this->addSql("ALTER TABLE typo3_typo3cr_domain_model_nodedata ADD lastpublicationdatetime TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL");
     $this->addSql("UPDATE typo3_typo3cr_domain_model_nodedata SET lastpublicationdatetime = '" . $default . "' WHERE workspace = 'live'");
 }
 /**
  * {@inheritdoc}
  *
  * @param FlowQuery $flowQuery The FlowQuery object
  * @param array $arguments None
  * @return integer The cache lifetime in seconds or NULL if either no content collection was given or no child node had a "hiddenBeforeDateTime" or "hiddenAfterDateTime" property set
  */
 public function evaluate(FlowQuery $flowQuery, array $arguments)
 {
     $minimumDateTime = null;
     foreach ($flowQuery->getContext() as $contextNode) {
         $hiddenBeforeDateTime = $contextNode->getHiddenBeforeDateTime();
         if ($hiddenBeforeDateTime !== null && $hiddenBeforeDateTime > $this->now && ($minimumDateTime === null || $hiddenBeforeDateTime < $minimumDateTime)) {
             $minimumDateTime = $hiddenBeforeDateTime;
         }
         $hiddenAfterDateTime = $contextNode->getHiddenAfterDateTime();
         if ($hiddenAfterDateTime !== null && $hiddenAfterDateTime > $this->now && ($minimumDateTime === null || $hiddenAfterDateTime < $minimumDateTime)) {
             $minimumDateTime = $hiddenAfterDateTime;
         }
     }
     if ($minimumDateTime !== null) {
         $maximumLifetime = $minimumDateTime->getTimestamp() - $this->now->getTimestamp();
         if ($maximumLifetime > 0) {
             return $maximumLifetime;
         }
     }
     return null;
 }
 /**
  * @test
  */
 public function setStatusCodeSetStatusAndLastModificationDate()
 {
     $redirect = new Redirect('/source/path/', '/target/path/', 303, 'www.host.com');
     $now = new Now();
     $redirect->setStatusCode(301);
     $this->assertSame(301, $redirect->getStatusCode());
     $this->assertSame($now->getTimestamp(), $redirect->getLastModificationDateTime()->getTimestamp());
 }