Example #1
0
 protected function _getHeader()
 {
     $buffer = '';
     $state = $this->runVar['settings']['is_running'] == 1 ? 'Running' : 'Disabled';
     $version = $this->_vers->versions->git->tag . 'r' . $this->_git->commits();
     $buffer .= sprintf($this->tmpMasks[2], "Monitor {$state} v{$version} [" . $this->runVar['constants']['sqlpatch'] . "]: ", $this->relativeTime($this->runVar['timers']['timer1']));
     $buffer .= sprintf($this->tmpMasks[1], "USP Connections:", sprintf("%d active (%d total) - %s:%d", $this->runVar['conncounts']['primary']['active'], $this->runVar['conncounts']['primary']['total'], $this->runVar['connections']['host'], $this->runVar['connections']['port']));
     if ($this->runVar['constants']['alternate_nntp']) {
         $buffer .= sprintf($this->tmpMasks[1], "USP Alternate:", sprintf("%d active (%d total) - %s:%d)", $this->runVar['conncounts']['alternate']['active'], $this->runVar['conncounts']['alternate']['total'], $this->runVar['connections']['host_a'], $this->runVar['connections']['port_a']));
     }
     $buffer .= sprintf($this->tmpMasks[1], "Newest Release:", $this->runVar['timers']['newOld']['newestrelname']);
     $buffer .= sprintf($this->tmpMasks[1], "Release Added:", sprintf("%s ago", isset($this->runVar['timers']['newOld']['newestrelease']) ? $this->relativeTime($this->runVar['timers']['newOld']['newestrelease']) : 0));
     $buffer .= sprintf($this->tmpMasks[1], "Predb Updated:", sprintf("%s ago", isset($this->runVar['timers']['newOld']['newestpre']) ? $this->relativeTime($this->runVar['timers']['newOld']['newestpre']) : 0));
     $buffer .= sprintf($this->tmpMasks[1], sprintf("Collection Age[%d]:", $this->runVar['constants']['delaytime']), sprintf("%s ago", isset($this->runVar['timers']['newOld']['oldestcollection']) ? $this->relativeTime($this->runVar['timers']['newOld']['oldestcollection']) : 0));
     $buffer .= sprintf($this->tmpMasks[1], "Parts in Repair:", number_format($this->runVar['counts']['now']['missed_parts_table']));
     if (($this->runVar['settings']['post'] == "1" || $this->runVar['settings']['post'] == "3") && $this->runVar['constants']['sequential'] != 2) {
         $buffer .= sprintf($this->tmpMasks[1], "Postprocess:", "stale for " . $this->relativeTime($this->runVar['timers']['timer3']));
     }
     return $buffer . PHP_EOL;
 }
Example #2
0
require_once realpath(dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'indexer.php');
use nzedb\db\DbUpdate;
use nzedb\utility\Git;
use nzedb\utility\Versions;
echo "Running pre-commit hooks\n";
$error = false;
// TODO Add code here to check permissions on staged files.
//$files = file(nZEDb_ROOT . 'nzedb/build/git-hooks'), FILE_IGNORE_NEW_LINES);
//foreach ($files as $file) {
//	echo "Filename: $file\n";
//}
/**
 * Add all hooks BEFORE the versions are updated so they can be skipped on any errors
 */
if ($error === false) {
    $git = new Git();
    $branch = $git->active_branch();
    if (in_array($branch, $git->mainBranches())) {
        // Only update versions, etc. on specific branches to lessen conflicts
        if ($error === false) {
            try {
                $vers = new Versions();
                $vers->checkAll();
                $vers->save();
                $git->add(nZEDb_VERSIONS);
            } catch (\Exception $e) {
                $error = 1;
                echo "Error while checking versions!\n";
                echo $e->getMessage() . "\n";
            }
        }
Example #3
0
 * You should have received a copy of the GNU General Public License
 * along with this program (see LICENSE.txt in the base directory.  If
 * not, see:
 *
 * @link <http://www.gnu.org/licenses/>.
 * @author niel
 * @copyright 2015 nZEDb
 */
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'www' . DIRECTORY_SEPARATOR . 'config.php';
use nzedb\db\DbUpdate;
use nzedb\utility\Git;
use nzedb\utility\Utility;
if (!Utility::isCLI()) {
    exit;
}
$error = false;
$git = new Git();
$branch = $git->active_branch();
if (in_array($branch, $git->mainBranches())) {
    // Only update patches, etc. on specific branches to lessen conflicts
    try {
        // Run DbUpdates to make sure we're up to date.
        $DbUpdater = new DbUpdate(['git' => $git]);
        $DbUpdater->newPatches(['safe' => false]);
    } catch (\Exception $e) {
        $error = 1;
        echo "Error while checking patches!\n";
        echo $e->getMessage() . "\n";
    }
}
exit($error);