Ejemplo n.º 1
0
 /**
  * @return int[]
  */
 public function computeFromCurrentYear()
 {
     $response = $this->connectToStorageInternalWorker->connect()->aggregate([['$match' => ['year' => date('Y')]], ['$group' => ['_id' => ['month' => '$month'], 'count' => ['$sum' => 1]]]]);
     $stats = [];
     for ($i = 0; $i <= 11; $i++) {
         $found = false;
         foreach ($response['result'] as $item) {
             if ($i == (int) $item['_id']['month']) {
                 $stats[] = $item['count'];
                 $found = true;
                 break;
             }
         }
         if (!$found) {
             $stats[] = 0;
         }
     }
     return $stats;
 }
Ejemplo n.º 2
0
 /**
  * Logs a deletion operation.
  *
  * @param string $uniqueness
  */
 public function logDeletion($uniqueness)
 {
     $created = time();
     $this->connectToStorageInternalWorker->connect()->insert(array('type' => 'deletion', 'uniqueness' => $uniqueness, 'year' => date('Y', $created), 'month' => date('m', $created), 'day' => date('d', $created)));
 }