当前位置: 首页>>代码示例>>PHP>>正文


PHP QueueManager::getQueueManagerInstance方法代码示例

本文整理汇总了PHP中QueueManager::getQueueManagerInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP QueueManager::getQueueManagerInstance方法的具体用法?PHP QueueManager::getQueueManagerInstance怎么用?PHP QueueManager::getQueueManagerInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueueManager的用法示例。


在下文中一共展示了QueueManager::getQueueManagerInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildPage

/**
 * builds page
 *
 */
function buildPage($action)
{
    global $cfg, $statusImage, $statusMessage, $htmlTitle, $htmlTop, $htmlMain;
    // navi
    $htmlTop .= '<a href="' . _FILE_THIS . '?t=0">Torrents</a>';
    $htmlTop .= ' | ';
    $htmlTop .= '<a href="' . _FILE_THIS . '?b=0">Backup</a>';
    $htmlTop .= ' | ';
    $htmlTop .= '<a href="' . _FILE_THIS . '?m=0">Maintenance</a>';
    $htmlTop .= ' | ';
    $htmlTop .= '<a href="' . _FILE_THIS . '?q=0">tfqmgr</a>';
    $htmlTop .= ' | ';
    $htmlTop .= '<a href="' . _FILE_THIS . '?a=1">Help</a>';
    $htmlTop .= ' | ';
    $htmlTop .= '<a href="' . _FILE_THIS . '?a=0">Version</a>';
    $htmlTop .= ' | ';
    $htmlTop .= '<a href="' . _FILE_THIS . '?a=5">News</a>';
    $htmlTop .= ' | ';
    $htmlTop .= '<a href="' . _FILE_THIS . '?a=2">Changelog</a>';
    $htmlTop .= ' | ';
    $htmlTop .= '<a href="' . _FILE_THIS . '?a=3" target="_blank">Issues</a>';
    $htmlTop .= ' | ';
    $htmlTop .= '<a href="' . _FILE_THIS . '?a=4">Update</a>';
    // body
    switch ($action) {
        case "b":
            // backup passthru
            $statusImage = "yellow.gif";
            break;
        case "-b":
            // backup-error passthru
            $statusImage = "red.gif";
            break;
        case "-u":
            // update-error passthru
            $statusImage = "red.gif";
            $htmlTitle = "Update";
            $htmlMain = '<br><font color="red"><strong>Update from your Version not possible.</strong></font>';
            $htmlMain .= '<br><br>';
            $htmlMain .= 'Please use the most recent tarball and perform a manual update.';
            $htmlMain .= '<br>';
            //$htmlMain .= '<br><br>';
            //$htmlMain .= getReleaseList();
            break;
        case "q":
            // queue passthru
            $statusImage = "black.gif";
            $htmlMain .= '<table width="100%" bgcolor="' . $cfg["table_data_bg"] . '" border="0" cellpadding="4" cellspacing="0"><tr><td width="100%">';
            $htmlMain .= '<a href="' . _FILE_THIS . '?q=1">log</a>';
            $htmlMain .= ' | ';
            $htmlMain .= '<a href="' . _FILE_THIS . '?q=2">ps</a>';
            include_once "QueueManager.php";
            $queueManager = QueueManager::getQueueManagerInstance($cfg);
            if ($queueManager->isQueueManagerRunning() && $queueManager->managerName == "tfqmgr") {
                $htmlMain .= ' | ';
                $htmlMain .= '<a href="' . _FILE_THIS . '?q=3">status</a>';
            }
            $htmlMain .= '</td><td align="right"><strong>tfqmgr</td>';
            $htmlMain .= '</td></tr></table>';
            break;
        case "m":
            // maintenance passthru
            $statusImage = "black.gif";
            $htmlMain .= '<table width="100%" bgcolor="' . $cfg["table_data_bg"] . '" border="0" cellpadding="4" cellspacing="0"><tr><td width="100%">';
            $htmlMain .= '<a href="' . _FILE_THIS . '?m=1">clean</a>';
            $htmlMain .= ' | ';
            $htmlMain .= '<a href="' . _FILE_THIS . '?m=2">kill</a>';
            $htmlMain .= ' | ';
            $htmlMain .= '<a href="' . _FILE_THIS . '?m=3">repair</a>';
            $htmlMain .= '</td><td align="right"><strong>Maintenance</td>';
            $htmlMain .= '</td></tr></table>';
            break;
        case "t":
            // torrent passthru
            $statusImage = "black.gif";
            $htmlMain .= '<table width="100%" bgcolor="' . $cfg["table_data_bg"] . '" border="0" cellpadding="4" cellspacing="0"><tr><td width="100%">';
            $htmlMain .= '<a href="' . _FILE_THIS . '?t=1">Stop All Torrents</a>';
            $htmlMain .= ' | ';
            $htmlMain .= '<a href="' . _FILE_THIS . '?t=2">Start All Torrents</a>';
            $htmlMain .= ' | ';
            $htmlMain .= '<a href="' . _FILE_THIS . '?t=3">Resume All Torrents</a>';
            $htmlMain .= '</td><td align="right"><strong>Torrents</td>';
            $htmlMain .= '</td></tr></table>';
            break;
        case "0":
            // version
            $htmlTitle = "Version";
            // version-check
            $versionAvailable = trim(getDataFromUrl(_SUPERADMIN_URLBASE . _VERSION_REMOTE));
            if (isset($versionAvailable) && $versionAvailable != "") {
                // set image
                if ($versionAvailable == _VERSION_THIS || substr(_VERSION_THIS, 0, 3) == "svn") {
                    $statusImage = "green.gif";
                } else {
                    $statusImage = "red.gif";
                }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:tf-b4rt-svn,代码行数:101,代码来源:superadmin.php

示例2: doStartTorrentClient

 /**
  * do start of a bittorrent-client.
  */
 function doStartTorrentClient()
 {
     include_once "AliasFile.php";
     if ($this->status != 2) {
         $this->status = -1;
         $this->messages .= "Error. ClientHandler in wrong state on execStart-request.";
         return;
     }
     // write the session to close so older version of PHP will not hang
     session_write_close("TorrentFlux");
     $torrentRunningFlag = 1;
     if ($this->af->running == "3") {
         // _queue_
         //writeQinfo($this->cfg["torrent_file_path"]."queue/".$this->alias.".stat",$this->command);
         include_once "QueueManager.php";
         $queueManager = QueueManager::getQueueManagerInstance($this->cfg);
         $queueManager->command = $this->command;
         // tfQmanager...
         $queueManager->enqueueTorrent($this->torrent);
         AuditAction($this->cfg["constants"]["queued_torrent"], $this->torrent . "<br>Die:" . $this->runtime . ", Sharekill:" . $this->sharekill . ", MaxUploads:" . $this->maxuploads . ", DownRate:" . $this->drate . ", UploadRate:" . $this->rate . ", Ports:" . $this->minport . "-" . $this->maxport . ", SuperSeed:" . $this->superseeder . ", Rerequest Interval:" . $this->rerequest);
         AuditAction($this->cfg["constants"]["queued_torrent"], $this->command);
         $torrentRunningFlag = 0;
     } else {
         // The following command starts the torrent running! w00t!
         //system('echo command >> /tmp/fluxi.debug; echo "'. $this->command .'" >> /tmp/fluxi.debug');
         $this->callResult = exec($this->command);
         AuditAction($this->cfg["constants"]["start_torrent"], $this->torrent . "<br>Die:" . $this->runtime . ", Sharekill:" . $this->sharekill . ", MaxUploads:" . $this->maxuploads . ", DownRate:" . $this->drate . ", UploadRate:" . $this->rate . ", Ports:" . $this->minport . "-" . $this->maxport . ", SuperSeed:" . $this->superseeder . ", Rerequest Interval:" . $this->rerequest);
         // slow down and wait for thread to kick off.
         // otherwise on fast servers it will kill stop it before it gets a chance to run.
         sleep(1);
         $torrentRunningFlag = 1;
     }
     if ($this->messages == "") {
         // Save torrent settings
         saveTorrentSettings($this->torrent, $torrentRunningFlag, $this->rate, $this->drate, $this->maxuploads, $this->runtime, $this->sharekill, $this->minport, $this->maxport, $this->maxcons, $this->savepath, $this->handlerName);
         $this->status = 3;
     } else {
         AuditAction($this->cfg["constants"]["error"], $this->messages);
         $this->status = -1;
     }
 }
开发者ID:BackupTheBerlios,项目名称:tf-b4rt-svn,代码行数:44,代码来源:ClientHandler.php

示例3: sleep

         }
         include_once "ClientHandler.php";
         $clientHandler = ClientHandler::getClientHandlerInstance($cfg, $btclient);
         $clientHandler->startTorrentClient(urldecode($element), 0);
         // just a sec..
         sleep(1);
     }
     break;
 case "torrentDeQueue":
     /* torrentDeQueue */
     if ($torrentRunningFlag == 0) {
         // set request var
         $_REQUEST['alias_file'] = getAliasName($element) . ".stat";
         // dequeue it
         include_once "QueueManager.php";
         $queueManager = QueueManager::getQueueManagerInstance($cfg);
         $queueManager->dequeueTorrent($element);
         // just a sec..
         sleep(1);
     }
     break;
 case "torrentResetTotals":
     /* torrentResetTotals */
     resetTorrentTotals(urldecode($element), false);
     break;
 default:
     if ($torrentRunningFlag != 0) {
         // stop torrent first
         $clientHandler = ClientHandler::getClientHandlerInstance($cfg, $btclient);
         $clientHandler->stopTorrentClient(urldecode($element), $alias);
         // give the torrent some time to die
开发者ID:BackupTheBerlios,项目名称:tf-b4rt-svn,代码行数:31,代码来源:multi.php

示例4: queueSettings

function queueSettings()
{
    global $cfg;
    include_once "AliasFile.php";
    include_once "RunningTorrent.php";
    include_once "QueueManager.php";
    $queueManager = QueueManager::getQueueManagerInstance($cfg);
    // QueueManager Running ?
    $queueManagerRunning = false;
    $shutdown = getRequestVar('s');
    if (isset($shutdown) && $shutdown == "1") {
        $queueManagerRunning = false;
    } else {
        if ($queueManager->isQueueManagerRunning()) {
            $queueManagerRunning = true;
        } else {
            if ($queueManager->managerName == "tfqmgr") {
                if ($queueManager->isQueueManagerReadyToStart()) {
                    $queueManagerRunning = false;
                } else {
                    $queueManagerRunning = true;
                }
            } else {
                $queueManagerRunning = false;
            }
        }
    }
    // head
    DisplayHead("Administration - Queue Settings");
    // Admin Menu
    displayMenu();
    // message section
    $message = getRequestVar('m');
    if (isset($message) && $message != "") {
        echo '<table cellpadding="5" cellspacing="0" border="0" width="100%">';
        echo '<tr><td align="center" bgcolor="' . $cfg["table_header_bg"] . '"><strong>';
        echo urldecode($message);
        echo '</strong></td></tr></table>';
    }
    // Queue Manager Section
    echo "<div align=\"center\">";
    echo "<a name=\"QManager\" id=\"QManager\"></a>";
    echo "<table width=\"100%\" border=1 bordercolor=\"" . $cfg["table_admin_border"] . "\" cellpadding=\"2\" cellspacing=\"0\" bgcolor=\"" . $cfg["table_data_bg"] . "\">";
    echo "<tr><td bgcolor=\"" . $cfg["table_header_bg"] . "\" background=\"themes/" . $cfg["theme"] . "/images/bar.gif\">";
    echo "<font class=\"title\">";
    //if(checkQManager() > 0)
    //	   echo "&nbsp;&nbsp;<img src=\"images/green.gif\" align=\"absmiddle\" align=\"absmiddle\"> Queue Manager Running [PID=".getQManagerPID()." with ".strval(getRunningTorrentCount())." torrent(s)]";
    if ($queueManagerRunning) {
        echo "&nbsp;&nbsp;<img src=\"images/green.gif\" align=\"absmiddle\" align=\"absmiddle\"> Queue Manager Running (" . $queueManager->managerName . "; pid: " . $queueManager->getQueueManagerPid() . ")";
    } else {
        echo "&nbsp;&nbsp;<img src=\"images/black.gif\" align=\"absmiddle\"> Queue Manager Off";
    }
    echo "</font>";
    echo "</td></tr><tr><td align=\"center\">";
    ?>
	<script language="JavaScript">
	function validateSettings()
	{
		var rtnValue = true;
		var msg = "";
		if (isNumber(document.theForm.maxServerThreads.value) == false)
		{
			msg = msg + "* Max Server Threads must be a valid number.\n";
			document.theForm.maxServerThreads.focus();
		}
		if (isNumber(document.theForm.maxUserThreads.value) == false)
		{
			msg = msg + "* Max User Threads must be a valid number.\n";
			document.theForm.maxUserThreads.focus();
		}
		if (isNumber(document.theForm.sleepInterval.value) == false)
		{
			msg = msg + "* Sleep Interval must be a valid number.\n";
			document.theForm.sleepInterval.focus();
		}

		if (msg != "")
		{
			rtnValue = false;
			alert("Please check the following:\n\n" + msg);
		}

		return rtnValue;
	}
	function isNumber(sText)
	{
		var ValidChars = "0123456789.";
		var IsNumber = true;
		var Char;

		for (i = 0; i < sText.length && IsNumber == true; i++)
		{
			Char = sText.charAt(i);
			if (ValidChars.indexOf(Char) == -1)
			{
				IsNumber = false;
			}
		}

		return IsNumber;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:tf-b4rt-svn,代码行数:101,代码来源:admin.php


注:本文中的QueueManager::getQueueManagerInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。