Move files to logical positions, no more copying of files.

This commit is contained in:
DariusIII
2015-05-27 00:39:04 +02:00
parent f6632f2679
commit ffa9797126
1472 changed files with 27 additions and 41 deletions
@@ -0,0 +1,37 @@
<?php
require_once("config.php");
use newznab\db\Settings;
$s = new Sites();
$site = $s->get();
$patches = $s->getUnappliedPatches($site);
if (count($patches) == 0)
echo "Patchn : No patches required applying. At version ".$site->dbversion."\n";
else
{
echo "Patchn : Database at version ".$site->dbversion."\n";
foreach ($patches as $patch)
{
echo "Patchn : Executing patch ".basename($patch)."\n";
$db = new Settings();
$rows = $db->query("select * from settings");
$dbData = file_get_contents($patch);
//fix to remove BOM in UTF8 files
$bom = pack("CCC", 0xef, 0xbb, 0xbf);
if (0 == strncmp($dbData, $bom, 3)) {
$dbData = substr($dbData, 3);
}
$queries = explode(";", $dbData);
$queries = array_map("trim", $queries);
foreach($queries as $q) {
if (strlen($q) > 0)
$db->exec($q);
}
}
}