本文整理汇总了PHP中Releases类的典型用法代码示例。如果您正苦于以下问题:PHP Releases类的具体用法?PHP Releases怎么用?PHP Releases使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Releases类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sendToNZBGet
public function sendToNZBGet($guid)
{
$releases = new Releases();
$reldata = $releases->getByGuid($guid);
$url = "{$this->serverurl}getnzb/{$guid}&i={$this->uid}&r={$this->rsstoken}";
$header = <<<NZBGet_URL
<?xml version="1.0"?>
<methodCall>
\t<methodName>appendurl</methodName>
\t<params>
\t\t<param>
\t\t\t<value><string>{$reldata['searchname']}.nzb</string></value>
\t\t</param>
\t\t<param>
\t\t\t<value><string>{$reldata['category_name']}</string></value>
\t\t</param>
\t\t<param>
\t\t\t<value><i4>0</i4></value>
\t\t</param>
\t\t<param>
\t\t\t<value><boolean>>False</boolean></value>
\t\t</param>
\t\t<param>
\t\t\t<value>
\t\t\t\t<string>{$url}</string>
\t\t\t</value>
\t\t</param>
\t</params>
</methodCall>
NZBGet_URL;
getUrl($this->fullurl() . "appendurl", "POST", $header);
}
开发者ID:scriptzteam,项目名称:newzNZB-premium-indexer,代码行数:32,代码来源:nzbget.php
示例2: delete
public function delete($id)
{
$db = new DB();
$this->delCartForUser($id);
$this->delUserCategoryExclusions($id);
$releases = new Releases();
$releases->deleteCommentsForUser($id);
$forum = new Forum();
$forum->deleteUser($id);
$db->query(sprintf("delete from users where ID = %d", $id));
}
开发者ID:nubzzz,项目名称:newznab,代码行数:11,代码来源:users.php
示例3: sendURLToNZBGet
/**
* Send a NZB URL to NZBGet.
*
* @param string $guid Release identifier.
*
* @return bool|mixed
*
* @access public
*/
public function sendURLToNZBGet($guid)
{
$reldata = $this->Releases->getByGuid($guid);
$header = '<?xml version="1.0"?>
<methodCall>
<methodName>appendurl</methodName>
<params>
<param>
<value><string>' . $reldata['searchname'] . '.nzb' . '</string></value>
</param>
<param>
<value><string>' . $reldata['category_name'] . '</string></value>
</param>
<param>
<value><i4>0</i4></value>
</param>
<param>
<value><boolean>>False</boolean></value>
</param>
<param>
<value>
<string>' . $this->serverurl . 'getnzb/' . $guid . '%26i%3D' . $this->uid . '%26r%3D' . $this->rsstoken . '</string>
</value>
</param>
</params>
</methodCall>';
nzedb\utility\getUrl($this->fullURL . 'appendurl', 'post', $header);
}
开发者ID:Jay204,项目名称:nZEDb,代码行数:37,代码来源:NZBGet.php
示例4: sendURLToNZBGet
/**
* Send a NZB URL to NZBGet.
*
* @param string $guid Release identifier.
*
* @return bool|mixed
*
* @access public
*/
public function sendURLToNZBGet($guid)
{
$reldata = $this->Releases->getByGuid($guid);
$url = "{$this->serverurl}getnzb/{$guid}&i={$this->uid}&r={$this->rsstoken}";
$header = '<?xml version="1.0"?>
<methodCall>
<methodName>appendurl</methodName>
<params>
<param>
<value><string>' . $reldata['searchname'] . '.nzb' . '</string></value>
</param>
<param>
<value><string>' . $reldata['category_name'] . '</string></value>
</param>
<param>
<value><i4>0</i4></value>
</param>
<param>
<value><boolean>>False</boolean></value>
</param>
<param>
<value>
<string>' . $url . '</string>
</value>
</param>
</params>
</methodCall>';
Utility::getUrl(['url' => $this->fullURL . 'appendurl', 'method' => 'post', 'postdata' => $header, 'verifycert' => false]);
}
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:38,代码来源:NZBGet.php
示例5: getInstance
public static function getInstance()
{
if (!self::$releases_instance) {
self::$releases_instance = new Releases();
}
return self::$releases_instance;
}
开发者ID:rasstroen,项目名称:hardtechno,代码行数:7,代码来源:Releases.php
示例6: purge
public function purge($id)
{
$db = new DB();
$releases = new Releases();
$binaries = new Binaries();
$this->reset($id);
$rels = $db->query(sprintf("select ID from releases where groupID = %d", $id));
foreach ($rels as $rel) {
$releases->delete($rel["ID"]);
}
$bins = $db->query(sprintf("select ID from binaries where groupID = %d", $id));
foreach ($bins as $bin) {
$binaries->delete($bin["ID"]);
}
}
开发者ID:nubzzz,项目名称:newznab,代码行数:15,代码来源:groups.php
示例7: deleteReleases
/**
* Delete releases from the database.
*/
protected function deleteReleases()
{
$deletedCount = 0;
foreach ($this->result as $release) {
if ($this->delete) {
$this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage);
if ($this->echoCLI) {
echo $this->pdo->log->primary('Deleting: ' . $this->method . ': ' . $release['searchname']);
}
} elseif ($this->echoCLI) {
echo $this->pdo->log->primary('Would be deleting: ' . $this->method . ': ' . $release['searchname']);
}
$deletedCount++;
}
$this->deletedCount += $deletedCount;
return true;
}
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:20,代码来源:ReleaseRemover.php
示例8: __construct
/**
* @param array $options Echo to cli / Class instances.
*/
public function __construct(array $options = [])
{
$defaults = ['Echo' => false, 'ReleaseImage' => null, 'Settings' => null];
$options += $defaults;
$this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$this->releaseImage = $options['ReleaseImage'] instanceof ReleaseImage ? $options['ReleaseImage'] : new ReleaseImage($this->pdo);
$this->movieqty = $this->pdo->getSetting('maxxxxprocessed') != '' ? $this->pdo->getSetting('maxxxxprocessed') : 100;
$this->showPasswords = Releases::showPasswords($this->pdo);
$this->debug = NN_DEBUG;
$this->echooutput = $options['Echo'] && NN_ECHOCLI;
$this->imgSavePath = NN_COVERS . 'xxx' . DS;
$this->cookie = NN_TMP . 'xxx.cookie';
if (NN_DEBUG || NN_LOGGING) {
$this->debug = true;
try {
$this->debugging = new \Logger();
} catch (\LoggerException $error) {
$this->_debug = false;
}
}
}
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:24,代码来源:XXX.php
示例9: downloadPage
function downloadPage()
{
global $app;
try {
$releases = new Releases();
$winstable = [$releases->latestWin32Asset(), $releases->latestWin64Asset()];
$winpre = [$releases->latestWin32Asset(false), $releases->latestWin64Asset(false)];
$osxstable = $releases->latestOSXAsset();
$osxpre = $releases->latestOSXAsset(false);
if ($winpre[0]['created_at'] < $winstable[0]['created_at']) {
$winpre = null;
}
if ($osxpre['created_at'] < $osxstable['created_at']) {
$osxpre = null;
}
$vars = ['winstable' => $winstable, 'winpre' => $winpre, 'osxstable' => $osxstable, 'osxpre' => $osxpre];
} catch (Exception $e) {
error_log($e);
return $app['twig']->render('download/error.twig');
}
return $app['twig']->render('download/index.twig', $vars);
}
开发者ID:kmklr72,项目名称:lmms.io,代码行数:22,代码来源:views.php
示例10: dirname
<?php
include dirname(__FILE__) . '/autoload.php';
Releases::get('alfred-spotify-controls', '2.2.10');
开发者ID:RStankov,项目名称:config_files,代码行数:4,代码来源:releases.php
示例11: Releases
$page->smarty->assign('rid', $rid);
$page->smarty->assign('show', $show);
if (isset($_REQUEST['from'])) {
$page->smarty->assign('from', $_REQUEST['from']);
}
$page->content = $page->smarty->fetch('myshows-add.tpl');
$page->render();
}
break;
case 'browse':
$page->title = "Browse My Shows";
$page->meta_title = "My Shows";
$page->meta_keywords = "search,add,to,cart,nzb,description,details";
$page->meta_description = "Browse Your Shows";
$shows = $us->getShows($users->currentUserId());
$releases = new Releases();
$browsecount = $releases->getShowsCount($shows, -1, $page->userdata["categoryexclusions"]);
$offset = isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset']) ? $_REQUEST["offset"] : 0;
$ordering = $releases->getBrowseOrdering();
$orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : '';
$results = array();
$results = $releases->getShowsRange($shows, $offset, ITEMS_PER_PAGE, $orderby, -1, $page->userdata["categoryexclusions"]);
$page->smarty->assign('pagertotalitems', $browsecount);
$page->smarty->assign('pageroffset', $offset);
$page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE);
$page->smarty->assign('pagerquerybase', WWW_TOP . "/myshows/browse?ob=" . $orderby . "&offset=");
$page->smarty->assign('pagerquerysuffix', "#results");
$pager = $page->smarty->fetch($page->getCommonTemplate("pager.tpl"));
$page->smarty->assign('pager', $pager);
foreach ($ordering as $ordertype) {
$page->smarty->assign('orderby' . $ordertype, WWW_TOP . "/myshows/browse?ob=" . $ordertype . "&offset=0");
开发者ID:ehsanguru,项目名称:nnplus,代码行数:31,代码来源:myshows.php
示例12: __construct
/**
* @param array $options Class instances / Echo to CLI.
*/
public function __construct(array $options = [])
{
$defaults = ['Echo' => false, 'Logger' => null, 'ReleaseImage' => null, 'Settings' => null, 'TMDb' => null];
$options += $defaults;
$this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$this->releaseImage = $options['ReleaseImage'] instanceof \ReleaseImage ? $options['ReleaseImage'] : new \ReleaseImage($this->pdo);
$this->lookuplanguage = $this->pdo->getSetting('lookuplanguage') != '' ? (string) $this->pdo->getSetting('lookuplanguage') : 'en';
$this->fanartapikey = $this->pdo->getSetting('fanarttvkey');
$this->imdburl = $this->pdo->getSetting('imdburl') == 0 ? false : true;
$this->movieqty = $this->pdo->getSetting('maximdbprocessed') != '' ? $this->pdo->getSetting('maximdbprocessed') : 100;
$this->searchEngines = true;
$this->showPasswords = Releases::showPasswords($this->pdo);
$this->debug = NN_DEBUG;
$this->echooutput = $options['Echo'] && NN_ECHOCLI && $this->pdo->cli;
$this->imgSavePath = NN_COVERS . 'movies' . DS;
$this->service = '';
if (NN_DEBUG || NN_LOGGING) {
$this->debug = true;
try {
$this->debugging = new \Logger();
} catch (\LoggerException $error) {
$this->_debug = false;
}
}
}
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:28,代码来源:Film.php
示例13: AdminPage
<?php
require_once "config.php";
$page = new AdminPage();
$users = new Users();
$releases = new Releases();
$page->title = "Site Stats";
$topgrabs = $users->getTopGrabbers();
$page->smarty->assign('topgrabs', $topgrabs);
$topdownloads = $releases->getTopDownloads();
$page->smarty->assign('topdownloads', $topdownloads);
$topcomments = $releases->getTopComments();
$page->smarty->assign('topcomments', $topcomments);
$recent = $releases->getRecentlyAdded();
$page->smarty->assign('recent', $recent);
$usersbymonth = $users->getUsersByMonth();
$page->smarty->assign('usersbymonth', $usersbymonth);
$usersbyrole = $users->getUsersByRole();
$page->smarty->assign('usersbyrole', $usersbyrole);
$usersbyhosthash = $users->getUsersByHostHash();
$page->smarty->assign('usersbyhosthash', $usersbyhosthash);
$loginsbymonth = $users->getLoginCountsByMonth();
$page->smarty->assign('loginsbymonth', $loginsbymonth);
$page->content = $page->smarty->fetch('site-stats.tpl');
$page->render();
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:25,代码来源:site-stats.php
示例14: NZB
<?php
use newznab\db\Settings;
$nzb = new NZB($page->settings);
$rel = new Releases(['Settings' => $page->settings]);
$uid = 0;
// Page is accessible only by the rss token, or logged in users.
if ($page->users->isLoggedIn()) {
$uid = $page->users->currentUserId();
$maxdls = $page->userdata["downloadrequests"];
$rsstoken = $page->userdata['rsstoken'];
} else {
if ($page->settings->getSetting('registerstatus') == Settings::REGISTER_STATUS_API_ONLY) {
$res = $page->users->getById(0);
} else {
if (!isset($_GET["i"]) || !isset($_GET["r"])) {
header("X-DNZB-RCode: 400");
header("X-DNZB-RText: Bad request, please supply all parameters!");
$page->show403();
}
$res = $page->users->getByIdAndRssToken($_GET["i"], $_GET["r"]);
if (!$res) {
header("X-DNZB-RCode: 401");
header("X-DNZB-RText: Unauthorised, wrong user ID or rss key!");
$page->show403();
}
}
$uid = $res["id"];
$rsstoken = $res['rsstoken'];
$maxdls = $res["downloadrequests"];
}
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:31,代码来源:getnzb.php
示例15: processGID
public function processGID($limit = 500, $batch = 5000, $delete_broken_releases = false)
{
// Process until someone presses cntrl-c
$db = new Settings();
$nzb = new NZB();
$processed = 0;
// We need an offset for tracking unhandled issues
$offset = 0;
$fsql = 'SELECT id, name, guid FROM releases ' . 'WHERE gid IS NULL ORDER BY adddate DESC LIMIT %d,%d';
$usql = "UPDATE releases SET gid = '%s' WHERE id = %d";
while (1) {
// finish
if ($limit > 0 && $processed >= $limit) {
break;
}
$batch = $limit > 0 && $batch > $limit ? $limit : $batch;
$res = $db->query(sprintf($fsql, $offset, $batch));
if (!$res) {
break;
}
if (count($res) <= 0) {
break;
}
$offset += $batch;
foreach ($res as $r) {
$nzbfile = $nzb->getNZBPath($r["guid"]);
if ($nzbfile === Null) {
continue;
}
$nzbInfo = new NZBInfo();
if (!$nzbInfo->loadFromFile($nzbfile)) {
if ($delete_broken_releases) {
$release = new Releases();
$release->deleteSingle(['g' => $r['guid'], 'i' => $r['id']], $this->nzb, $this->releaseImage);
// Free the variable in an attempt to recover memory
unset($release);
echo '-';
} else {
// Skip over this one for future fetches
$offset++;
}
continue;
}
$gid = false;
if (!empty($nzbInfo->gid)) {
$gid = $nzbInfo->gid;
}
// Free the variable in an attempt to recover memory
unset($nzbInfo);
if (!$gid) {
if ($delete_broken_releases) {
$release = new Releases();
$release->{$release}->deleteSingle(['g' => $r['guid'], 'i' => $r['id']], $this->nzb, $this->releaseImage);
unset($release);
echo '-';
} else {
// Skip over this one for future fetches
$offset++;
}
continue;
}
// Update DB With Global Identifer
$ures = $db->queryExec(sprintf("UPDATE releases SET gid = %s WHERE id = %d", $db->escapeString($gid), $r['id']));
if ($ures->rowCount() == 0) {
printf("\nPostPrc : Failed to update: %s\n", $r['name']);
}
// make noise...
echo '.';
$processed += 1;
}
}
# Batch update for comment table
/*$usql = 'UPDATE release_comments, releases '
.'SET release_comments.gid = releases.gid, '
.'release_comments.nzb_guid = releases.nzb_guid '
.'WHERE releases.id = release_comments.releaseid '
.'AND release_comments.gid IS NULL '
.'AND release_comments.nzb_guid = "" '
.'AND releases.nzb_guid IS NOT NULL '
.'AND releases.gid IS NOT NULL ';*/
$affected = $db->queryExec(sprintf('UPDATE release_comments, releases SET release_comments.gid = releases.gid,
release_comments.nzb_guid = releases.nzb_guid
WHERE releases.id = release_comments.releaseid
AND release_comments.gid IS NULL
AND release_comments.nzb_guid = ""
AND releases.nzb_guid IS NOT NULL
AND releases.gid IS NOT NULL '));
$rows = $affected->rowCount();
if ($rows > 0) {
$processed += $rows;
}
return $processed;
}
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:93,代码来源:SpotNab.php
示例16: dirname
<?php
require_once dirname(__FILE__) . '/../../../www/config.php';
use nzedb\db\Settings;
$pdo = new Settings();
if ($argc < 3 || !isset($argv[1]) || isset($argv[1]) && !is_numeric($argv[1])) {
exit($pdo->log->error("\nIncorrect argument suppplied. This script will delete all duplicate releases matching on name, fromname, group_id and size.\n" . "Unfortunately, I can not guarantee which copy will be deleted.\n\n" . "php remove_exact_dupes.php 10 exact ...: To delete all duplicates added within the last 10 hours.\n" . "php remove_exact_dupes.php 10 near ...: To delete all duplicates with size variation of 1% and added within the last 10 hours.\n" . "php remove_exact_dupes.php 0 exact ...: To delete all duplicates.\n" . "php remove_exact_dupes.php 0 near ...: To delete all duplicates with size variation of 1%.\n" . "php remove_exact_dupes.php 10 exact dupes/ ...: To delete all duplicates added within the last 10 hours and save a copy of the nzb to dupes folder.\n"));
}
$crosspostt = $argv[1];
$releases = new Releases(['Settings' => $pdo]);
$count = $total = $all = 0;
$nzb = new NZB($pdo);
$ri = new ReleaseImage($pdo);
$consoleTools = new ConsoleTools(['ColorCLI' => $pdo->log]);
$size = ' size ';
if ($argv[2] === 'near') {
$size = ' size between (size *.99) AND (size * 1.01) ';
}
if ($crosspostt != 0) {
$query = sprintf('SELECT max(id) AS id, id AS idx, guid FROM releases WHERE adddate > (NOW() - INTERVAL %d HOUR) GROUP BY name, fromname, group_id,' . $size . 'HAVING COUNT(*) > 1', $crosspostt);
} else {
$query = sprintf('SELECT max(id) AS id, id AS idx, guid FROM releases GROUP BY name, fromname, group_id,' . $size . 'HAVING COUNT(*) > 1');
}
do {
$resrel = $pdo->queryDirect($query);
if ($resrel instanceof Traversable) {
$total = $resrel->rowCount();
echo $pdo->log->header(number_format($total) . " Releases have Duplicates");
foreach ($resrel as $rowrel) {
$nzbpath = $nzb->getNZBPath($rowrel['guid']);
if (isset($argv[3]) && is_dir($argv[3])) {
开发者ID:Jay204,项目名称:nZEDb,代码行数:31,代码来源:remove_exact_dupes.php
示例17: AdminPage
<?php
require_once "config.php";
require_once WWW_DIR . "/lib/adminpage.php";
require_once WWW_DIR . "/lib/releases.php";
$page = new AdminPage();
$releases = new Releases();
$category = new Category();
$previewtype = 1;
$page->title = "Preview List";
$previewcat = "-1";
if (isset($_REQUEST["previewcat"])) {
$previewcat = $_REQUEST["previewcat"];
}
$catarray = array();
$catarray[] = $previewcat;
$releasecount = $releases->getPreviewCount($previewtype, $catarray);
$offset = isset($_REQUEST["offset"]) ? $_REQUEST["offset"] : 0;
$page->smarty->assign('pagertotalitems', $releasecount);
$page->smarty->assign('pageroffset', $offset);
$page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE);
$page->smarty->assign('pagerquerybase', WWW_TOP . "/preview-list.php?previewcat=" . $previewcat . "&offset=");
$pager = $page->smarty->fetch("pager.tpl");
$page->smarty->assign('pager', $pager);
$parentcatlist = $category->getForMenu();
$page->smarty->assign('catlist', $parentcatlist);
$page->smarty->assign('previewcat', $previewcat);
$releaselist = $releases->getPreviewRange($previewtype, $catarray, $offset, ITEMS_PER_PAGE);
$page->smarty->assign('releaselist', $releaselist);
$page->content = $page->smarty->fetch('preview-list.tpl');
$page->render();
开发者ID:scriptzteam,项目名称:newzNZB-premium-indexer,代码行数:31,代码来源:preview-list.php
示例18: unset
* - Zend Engine: {this colon is unreliable and not used on a few occasions}
* . Fixed bug #54585 (track_errors causes segfault). (Dmitry)
* - Upgraded bundled Sqlite3 to version 3.7.4. (Ilia)
* These sub-sections only occur recently (5.2.7), the rest (PHP5 and 4) are
* like the second example.
*
* In many cases these files are huge(!) - as of 7/5/2011 5.3's NEWS is 5999
* lines and 4.4's tops out at 3955.
*/
for ($i = 0; $i < count($lines); $i++) {
if (strlen(trim($lines[$i])) == 0) {
unset($lines[$i]);
}
}
$lines = array_slice($lines, 0);
$releases = new Releases();
$curRelease = null;
$lastChange = null;
$curSection = null;
for ($i = 0; $i < count($lines); $i++) {
if ($i < 2) {
continue;
}
$releaseRegex = "/(?P<day>[0-9\\?]{2}) (?P<month>[A-Za-z\\?]{3}) (?P<year>[0-9\\?]{4}), (Version|PHP) (?P<version>[0-9\\.]+)/";
if (preg_match($releaseRegex, $lines[$i], $releaseMatches) === 1) {
// This is a release header
$release = new Release();
// Build date
$months = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
$date = mktime(0, 0, 0, $releaseMatches["month"] == "???" ? null : array_search($releaseMatches["month"], $months) + 1, $releaseMatches["day"] == "??" ? null : $releaseMatches["day"], $releaseMatches["year"] == "????" ? null : $releaseMatches["year"]);
$release->date = $date;
开发者ID:rmasters,项目名称:php-news,代码行数:31,代码来源:parser.php
示例19: Releases
<?php
require_once WWW_DIR . "/lib/releases.php";
require_once WWW_DIR . "/lib/category.php";
require_once WWW_DIR . "/lib/nzb.php";
$releases = new Releases();
$category = new Category();
$nzb = new NZB();
//
// api functions
//
$function = "s";
if (isset($_GET["t"])) {
if ($_GET["t"] == "details" || $_GET["t"] == "d") {
$function = "d";
} elseif ($_GET["t"] == "get" || $_GET["t"] == "g") {
$function = "g";
} elseif ($_GET["t"] == "search" || $_GET["t"] == "s") {
$function = "s";
} elseif ($_GET["t"] == "caps" || $_GET["t"] == "c") {
$function = "c";
} elseif ($_GET["t"] == "tvsearch" || $_GET["t"] == "tv") {
$function = "tv";
} elseif ($_GET["t"] == "movie" || $_GET["t"] == "m") {
$function = "m";
} elseif ($_GET["t"] == "register" || $_GET["t"] == "r") {
$function = "r";
} else {
showApiError(202);
}
} else {
开发者ID:ehsanguru,项目名称:nnplus,代码行数:31,代码来源:api.php
示例20: checkFiles
public function checkFiles(Releases $release)
{
if (!$release->id) {
throw new \LogicException('Unexpected empty release identifier in BleedingEdge::checkFiles()');
}
// Make sure we are given a release which exists
if (empty($release->category_id)) {
return;
}
// Set the category from the release if the model's category doesn't match
if ($this->category_id != $release->category_id || empty($this->folder)) {
$this->setCategory($release->category_id);
}
// Make sure the category was indeed set
if (empty($this->category) || empty($this->category_id) || empty($this->folder)) {
return;
}
// Can't proceed if it's not a bleedingedge category
if ($this->category->type != 'bleedingedge') {
return;
}
$potentialPrefix = substr($this->folder, 0, 5);
$potentialPrefix = strtolower($potentialPrefix);
$useS3 = $potentialPrefix == 's3://';
// Safe fallback
$folderName = $release->version;
if ($useS3) {
// On S3 it's always the version-as-folder, otherwise it'd take FOREVER to scan S3
$folder = $this->folder . '/' . $release->version;
$known_folders[] = $release->version;
} else {
$folderName = $this->getReleaseFolder($this->folder, $release->version, $release->alias, $release->maturity);
if ($folderName === false) {
// Normally this shouldn't happen!
return;
} else {
$known_folders[] = $folderName;
$folder = $this->folder . '/' . $folderName;
}
}
// Do we have a changelog?
if (empty($release->notes)) {
$changelog = $folder . '/CHANGELOG';
$hasChangelog = false;
$this_changelog = '';
if ($useS3) {
$s3 = AmazonS3::getInstance();
$response = $s3->getObject(substr($changelog, 5));
$hasChangelog = $response !== false;
if ($hasChangelog) {
$this_changelog = $response;
}
} else {
if (\JFile::exists($changelog)) {
$hasChangelog = true;
$this_changelog = @file_get_contents($changelog);
}
}
if ($hasChangelog) {
$first_changelog = array();
$notes = $this->coloriseChangelog($this_changelog, $first_changelog);
$release->notes = $notes;
$release->save();
}
}
$release->getRelations()->rebase($release);
$known_items = array();
if ($useS3) {
$files = array();
$everything = $this->_listS3Contents($folder);
$dirLength = strlen($folder) - 5;
if (count($everything)) {
foreach ($everything as $path => $info) {
if (array_key_exists('size', $info) && substr($path, -1) != '/') {
if (substr($path, 0, $dirLength) == substr($folder, 5)) {
$path = substr($path, $dirLength);
}
$path = trim($path, '/');
$files[] = $path;
}
}
}
} else {
$files = \JFolder::files($folder);
}
if ($release->items->count()) {
/** @var Items $item */
foreach ($release->items as $item) {
$known_items[] = basename($item->filename);
if ($item->published && !in_array(basename($item->filename), $files)) {
$item->unpublish();
}
if (!$item->published && in_array(basename($item->filename), $files)) {
$item->publish();
}
}
}
if (!empty($files)) {
foreach ($files as $file) {
if (basename($file) == 'CHANGELOG') {
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:
注:本文中的Releases类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论