Example #1
0
 /**
  * @since 1.18
  *
  * @param Database $db
  *
  * @return array
  */
 public static function listTables(Database $db)
 {
     $prefix = $db->tablePrefix();
     $tables = $db->listTables($prefix, __METHOD__);
     if ($db->getType() === 'mysql') {
         static $viewListCache = null;
         if ($viewListCache === null) {
             $viewListCache = $db->listViews(null, __METHOD__);
         }
         // T45571: cannot clone VIEWs under MySQL
         $tables = array_diff($tables, $viewListCache);
     }
     array_walk($tables, [__CLASS__, 'unprefixTable'], $prefix);
     // Don't duplicate test tables from the previous fataled run
     $tables = array_filter($tables, [__CLASS__, 'isNotUnittest']);
     if ($db->getType() == 'sqlite') {
         $tables = array_flip($tables);
         // these are subtables of searchindex and don't need to be duped/dropped separately
         unset($tables['searchindex_content']);
         unset($tables['searchindex_segdir']);
         unset($tables['searchindex_segments']);
         $tables = array_flip($tables);
     }
     return $tables;
 }