Example #1
0
 public static function populateHash()
 {
     set_time_limit(0);
     $files = [];
     $dbs = glob(STORAGE_PATH . DS . 'dbjson' . DS . '*');
     foreach ($dbs as $db) {
         $tables = glob($db . DS . '*');
         foreach ($tables as $table) {
             $rows = glob($table . DS . '*.row');
             foreach ($rows as $row) {
                 array_push($files, $row);
             }
         }
     }
     foreach ($files as $file) {
         $tab = explode(DS, $file);
         $db = str_replace('_' . APPLICATION_ENV, '', $tab[count($tab) - 3]);
         $table = $tab[count($tab) - 2];
         $instance = new self(jdb($db, $table));
         $newFile = $instance->hashFile($file);
         File::move($file, $newFile);
     }
 }