Esempio n. 1
0
 public function uninstall()
 {
     global $wpdb;
     $table_name = pusherTableName();
     $sql = "DROP TABLE IF EXISTS {$table_name};";
     $wpdb->query($sql);
 }
 public function store(Theme $theme)
 {
     global $wpdb;
     $model = new PackageModel(array('package' => $theme->stylesheet, 'repository' => $theme->repository, 'branch' => $theme->repository->getBranch(), 'status' => 1, 'host' => $theme->repository->code, 'private' => $theme->repository->isPrivate(), 'ptd' => $theme->pushToDeploy, 'subdirectory' => $theme->getSubdirectory()));
     $table_name = pusherTableName();
     $count = $wpdb->get_var("SELECT COUNT(*) FROM {$table_name} WHERE package = '{$model->package}'");
     if ($count !== '0') {
         return $wpdb->update($table_name, array('status' => $model->status, 'branch' => $model->branch, 'subdirectory' => $model->subdirectory), array('package' => $model->package));
     }
     return $wpdb->insert($table_name, array('package' => $model->package, 'repository' => $model->repository, 'branch' => $model->branch, 'type' => 2, 'status' => $model->status, 'host' => $model->host, 'private' => $model->private, 'ptd' => $model->ptd, 'subdirectory' => $model->subdirectory));
 }