コード例 #1
0
ファイル: TmuxOutput.php プロジェクト: RickDB/newznab-tmux
 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], "Prehash Updated:", sprintf("%s ago", isset($this->runVar['timers']['newOld']['newestprehash']) ? $this->relativeTime($this->runVar['timers']['newOld']['newestprehash']) : 0));
     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;
 }
コード例 #2
0
ファイル: runHooks.php プロジェクト: RickDB/newznab-tmux
require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'www' . DIRECTORY_SEPARATOR . 'automated.config.php');
use newznab\db\DbUpdate;
use newznab\utility\Git;
use newznab\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, 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";
        }
        if ($error === false) {
            try {
                $vers = new Versions();
コード例 #3
0
ファイル: NewPatches.php プロジェクト: RickDB/newznab-tmux
 * 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 newznab\db\DbUpdate;
use newznab\utility\Git;
use newznab\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);