Exemplo n.º 1
0
 public function tearDown()
 {
     // clean up your test here if needed
     $tables = ArchiveTableCreator::getTablesArchivesInstalled();
     if (!empty($tables)) {
         Db::dropTables($tables);
     }
     parent::tearDown();
 }
Exemplo n.º 2
0
 public static function uninstall()
 {
     Db::dropTables(array(Common::prefixTable('alert'), Common::prefixTable('alert_triggered'), Common::prefixTable('alert_site')));
 }
Exemplo n.º 3
0
 public static function uninstall()
 {
     Db::dropTables(Common::prefixTable(self::$rawPrefix));
 }
Exemplo n.º 4
0
 /**
  * @throws Exception if non-recoverable error
  */
 public function uninstall()
 {
     Db::dropTables(Common::prefixTable('user_language'));
 }
Exemplo n.º 5
0
 /**
  * Purges old report/metric data.
  *
  * If $keepBasicMetrics is false, old numeric tables will be dropped, otherwise only
  * the metrics not in $metricsToKeep will be deleted.
  *
  * If $reportPeriodsToKeep is an empty array, old blob tables will be dropped. Otherwise,
  * specific reports will be deleted, except reports for periods in $reportPeriodsToKeep.
  *
  * @param bool $optimize If tables should be optimized after rows are deleted. Normally,
  *                       this is handled by a scheduled task.
  */
 public function purgeData($optimize = false)
 {
     // find archive tables to purge
     list($oldNumericTables, $oldBlobTables) = $this->getArchiveTablesToPurge();
     // process blob tables first, since archive status is stored in the numeric archives
     if (!empty($oldBlobTables)) {
         // if no reports should be kept, drop tables, otherwise drop individual reports
         if (empty($this->reportPeriodsToKeep) && !$this->keepSegmentReports) {
             Db::dropTables($oldBlobTables);
         } else {
             foreach ($oldBlobTables as $table) {
                 $where = $this->getBlobTableWhereExpr($oldNumericTables, $table);
                 if (!empty($where)) {
                     $where = "WHERE {$where}";
                 }
                 Db::deleteAllRows($table, $where, "idarchive ASC", $this->maxRowsToDeletePerQuery);
             }
             if ($optimize) {
                 Db::optimizeTables($oldBlobTables);
             }
         }
     }
     // deal with numeric tables
     if (!empty($oldNumericTables)) {
         // if keep_basic_metrics is set, empty all numeric tables of metrics to purge
         if ($this->keepBasicMetrics == 1 && !empty($this->metricsToKeep)) {
             $where = "WHERE name NOT IN ('" . implode("','", $this->metricsToKeep) . "') AND name NOT LIKE 'done%'";
             foreach ($oldNumericTables as $table) {
                 Db::deleteAllRows($table, $where, "idarchive ASC", $this->maxRowsToDeletePerQuery);
             }
             if ($optimize) {
                 Db::optimizeTables($oldNumericTables);
             }
         } else {
             Db::dropTables($oldNumericTables);
         }
     }
 }
Exemplo n.º 6
0
 static function downgradeFrom($version)
 {
     try {
         switch ($version) {
             case 2:
                 Db::dropTables(Common::prefixTable('chat_automatic_message'));
                 $sql = "ALTER TABLE " . Common::prefixTable('chat') . " DROP COLUMN `idautomsg`;";
                 Db::exec($sql);
                 break;
             case 1:
                 Db::dropTables(Common::prefixTable('chat'));
                 Db::dropTables(Common::prefixTable('chat_history_admin'));
                 Db::dropTables(Common::prefixTable('chat_personnal_informations'));
                 $sql = "ALTER TABLE " . Common::prefixTable('user') . " DROP COLUMN `last_poll`;";
                 Db::exec($sql);
                 break;
         }
     } catch (Exception $e) {
         throw $e;
     }
     self::setDbVersion($version - 1);
     return;
 }
 public function uninstall()
 {
     Db::dropTables(array($this->tableNamePrefixed));
 }
Exemplo n.º 8
0
 public function uninstall()
 {
     Db::dropTables(Common::prefixTable('user_dashboard'));
 }
 public function uninstall()
 {
     Db::dropTables(Common::prefixTable("snoopy"));
     Db::dropTables(Common::prefixTable("snoopy_visitors"));
     Db::dropTables(Common::prefixTable("snoopy_visitors_statuses"));
 }
Exemplo n.º 10
0
 /**
  * Deletes the DB table for private key storage, if exists.
  *
  * @throws Exception If there is an error in the SQL.
  */
 public static function deletePrivateKeyTable()
 {
     try {
         Db::dropTables(Common::prefixTable(static::KEY_TABLE));
     } catch (Exception $e) {
         // ignore error if table does not exist (1051 code is for 'unknown table')
         if (!Db::get()->isErrNo($e, '1051')) {
             throw $e;
         }
     }
 }
Exemplo n.º 11
0
 /**
  * Uninstalls the plugins. Derived classes should implement this method if the changes
  * made in {@link install()} need to be undone during uninstallation.
  *
  * In most cases, if you have an {@link install()} method, you should provide
  * an {@link uninstall()} method.
  *
  * @throws \Exception if uninstallation of fails for some reason.
  */
 public function uninstall()
 {
     Db::dropTables(Common::prefixTable('bannerstats'));
 }