Example #1
0
<?php

// rebuild cache on every pageload
iv::rebuildCache();
Example #2
0
 public function install($writer)
 {
     // Write files to disc and clean db
     $files = db()->query("SELECT path, content FROM update_file WHERE package = '%s' AND content IS NOT NULL", $this->id);
     foreach ($files as $file) {
         $writer->put($file['path'], base64_decode($file['content']));
     }
     // Remove files from db
     db()->query("UPDATE update_file SET content = NULL WHERE package = '%s'", $this->id);
     db()->query("OPTIMIZE TABLE `update_file` ");
     // Ensure stuff, you know
     $packageInfo = json_decode(file_get_contents($this->packageFileName()), true);
     if (isset($packageInfo['directories'])) {
         foreach ($packageInfo['directories'] as $dir => $mod) {
             $writer->dir($dir, $mod);
         }
     }
     if (class_exists('iv')) {
         iv::rebuildCache();
     }
     db()->update_package->insert(array('id' => $this->id, 'version' => $this->version, 'source' => $this->server), 'REPLACE');
 }