Ejemplo n.º 1
0
if ($error === false) {
    $git = new \nzedb\utility\Git();
    $branch = $git->active_branch();
    if (in_array($branch, $git->mainBranches())) {
        // Only update versions, patches, etc. on specific branches to lessen conflicts
        try {
            // Run DbUpdates to make sure we're up to date.
            $DbUpdater = new \nzedb\db\DbUpdate(['git' => $git]);
            $DbUpdater->newPatches(['safe' => false]);
        } catch (\Exception $e) {
            $error = 1;
            echo "Error while checking patches!\n";
        }
        if ($error === false) {
            try {
                $vers = new \nzedb\utility\Versions();
                $vers->checkAll();
                $vers->save();
                $git->add(nZEDb_VERSIONS);
            } catch (\Exception $e) {
                $error = 1;
                echo "Error while checking versions!\n";
            }
        }
    } else {
        echo "not 'dev', 'next-master', or 'master' branch, skipping version/patch updates\n";
    }
} else {
    echo "Error in pre-commit hooks!!\n";
}
exit($error);
Ejemplo n.º 2
0
     $cfg->dbCreateCheck = false;
     $cfg->error = true;
     $cfg->emessage = 'Could not select data from your database, check that tables and data are properly created/inserted.';
 } else {
     foreach ($reschk as $row) {
         if ($row['num'] > 0) {
             $dbInstallWorked = true;
             break;
         }
     }
 }
 $ver = new \nzedb\utility\Versions();
 $patch = $ver->getSQLPatchFromFiles();
 $pdo->setSetting(['..sqlpatch' => $patch]);
 if ($dbInstallWorked) {
     $ver = new \nzedb\utility\Versions();
     $patch = $ver->getSQLPatchFromFiles();
     if ($patch > 0) {
         $updateSettings = $pdo->setSetting(['section' => '', 'subsection' => '', 'name' => 'sqlpatch', 'value' => $patch]);
     } else {
         $updateSettings = false;
     }
     // If it all worked, move to the next page.
     if ($updateSettings) {
         header("Location: ?success");
         if (file_exists($cfg->DB_DIR . '/post_install.php')) {
             exec("php " . $cfg->DB_DIR . "/post_install.php {$pdo}");
         }
         exit;
     } else {
         $cfg->error = true;
Ejemplo n.º 3
0
    define('VERBOSE', true);
} else {
    define('VERBOSE', false);
}
$changed = false;
$source = __DIR__ . DS . 'git-hooks' . DS . PRE_COMMIT_HOOK;
$target = nZEDb_HOOKS . DS . PRE_COMMIT_HOOK;
if (!file_exists(nZEDb_HOOKS . PRE_COMMIT_HOOK)) {
    copy($source, $target);
}
$file = file($target, FILE_IGNORE_NEW_LINES);
if (preg_match('/^(?P<key>#version=)(?P<value>.*)$/', $file[1], $match)) {
    $current = $match['value'];
}
$out = new ColorCLI();
$versions = new \nzedb\utility\Versions();
$version = $versions->getGitHookPrecommit();
if ($version > $current) {
    copy($source, $target);
    echo $out->info("Updated pre-commit hook to version {$version}");
    $file = file($target, FILE_IGNORE_NEW_LINES);
}
chmod($target, 0774);
$count = count($file);
$index = 0;
while ($index < $count) {
    if (preg_match('/^#nZEDb hook\\s*-\\s*(.+)$/', $file[$index], $match)) {
        if (VERBOSE) {
            echo $out->primary("Matched: " . $file[$index]);
        }
        $index++;