subDay() public method

Subtracts $n number of days from $this date and returns a new Date object.
public subDay ( integer $n ) : Date
$n integer An integer > 0.
return Date
Ejemplo n.º 1
0
 /**
  * Updates the field ts_created for the specified websites.
  *
  * @param $idSites int Id Site to update ts_created
  * @param $minDate Date to set as creation date. To play it safe it will substract one more day.
  *
  * @ignore
  */
 public function updateSiteCreatedTime($idSites, Date $minDate)
 {
     $idSites = Site::getIdSitesFromIdSitesString($idSites);
     Piwik::checkUserHasAdminAccess($idSites);
     // Update piwik_site.ts_created
     $query = "UPDATE " . Common::prefixTable("site") . " SET ts_created = ?" . " WHERE idsite IN ( " . implode(",", $idSites) . " )\n\t\t\t\t\tAND ts_created > ?";
     $minDateSql = $minDate->subDay(1)->getDatetime();
     $bind = array($minDateSql, $minDateSql);
     Db::query($query, $bind);
 }
Ejemplo n.º 2
0
 /**
  * Updates the field ts_created for the specified websites.
  *
  * @param $idSites int Id Site to update ts_created
  * @param $minDate Date to set as creation date. To play it safe it will substract one more day.
  *
  * @ignore
  */
 public function updateSiteCreatedTime($idSites, Date $minDate)
 {
     $idSites = Site::getIdSitesFromIdSitesString($idSites);
     Piwik::checkUserHasAdminAccess($idSites);
     $minDateSql = $minDate->subDay(1)->getDatetime();
     $this->getModel()->updateSiteCreatedTime($idSites, $minDateSql);
 }
Ejemplo n.º 3
0
 private function updateSiteCreatedTime($idSites, Date $minDate)
 {
     $idSites = Site::getIdSitesFromIdSitesString($idSites);
     $minDateSql = $minDate->subDay(1)->getDatetime();
     $model = new SitesManagerModel();
     $model->updateSiteCreatedTime($idSites, $minDateSql);
 }
Ejemplo n.º 4
0
 private function updateSiteCreatedTime($idSites, Date $minDate)
 {
     $idSites = Site::getIdSitesFromIdSitesString($idSites);
     $minDateSql = $minDate->subDay(1)->getDatetime();
     #$model = new SitesManagerModel();
     $model = Factory::getModel('Piwik\\Plugins\\SitesManager');
     $model->updateSiteCreatedTime($idSites, $minDateSql);
 }