protected function archiveData()
 {
     $p = new Sampledatainstall();
     $path = $p->sendPath() . 'output/';
     $file_name = 'sample_data.zip';
     $files = array();
     if ($dh = opendir($path)) {
         while (($file = readdir($dh)) !== false) {
             if ($file != '.' && $file != '..') {
                 $files[] = $file;
             }
         }
         closedir($dh);
     }
     $zip = new ZipArchive();
     if ($zip->open($path . $file_name, ZipArchive::OVERWRITE | ZipArchive::CREATE) !== true) {
         $this->displayError($this->l('cannot open ' . $file_name . '\\n'));
     }
     foreach ($files as $file) {
         $zip->addFile($path . $file, ltrim($file, '/'));
     }
     if ($zip->close()) {
         foreach ($files as $file) {
             unlink($path . $file);
         }
     }
     $this->zipSave($path, $file_name);
 }
 protected function clearDb()
 {
     $new_path = new Sampledatainstall();
     $sql_list = Tools::scandir($new_path->sendPath() . 'input/', 'sql');
     foreach ($sql_list as $sql) {
         // return if sql file for this table is empty
         if (Tools::isEmpty(trim(file_get_contents($new_path->sendPath() . 'input/' . $sql)))) {
             return;
         }
         $table_name = explode('.', $sql);
         if ($table_name[0] != 'themeconfigurator') {
             $this->dropTable($table_name[0]);
         }
     }
 }