本文整理汇总了PHP中TIME函数的典型用法代码示例。如果您正苦于以下问题:PHP TIME函数的具体用法?PHP TIME怎么用?PHP TIME使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TIME函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendIcalEvent
function sendIcalEvent($from_name, $from_address, $to_name, $to_address, $startTime, $endTime, $subject, $description, $location)
{
$domain = 'exchangecore.com';
//Create Email Headers
$mime_boundary = "----Meeting Booking----" . MD5(TIME());
$headers = "From: " . $from_name . " <" . $from_address . ">\n";
$headers .= "Reply-To: " . $from_name . " <" . $from_address . ">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"\n";
$headers .= "Content-class: urn:content-classes:calendarmessage\n";
//Create Email Body (HTML)
$message = "--{$mime_boundary}\r\n";
$message .= "Content-Type: text/html; charset=UTF-8\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= "<html>\n";
$message .= "<body>\n";
$message .= '<p>Dear ' . $to_name . ',</p>';
$message .= '<p>' . $description . '</p>';
$message .= "</body>\n";
$message .= "</html>\n";
$message .= "--{$mime_boundary}\r\n";
$ical = 'BEGIN:VCALENDAR' . "\r\n" . 'PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN' . "\r\n" . 'VERSION:2.0' . "\r\n" . 'METHOD:REQUEST' . "\r\n" . 'BEGIN:VTIMEZONE' . "\r\n" . 'TZID:Eastern Time' . "\r\n" . 'BEGIN:STANDARD' . "\r\n" . 'DTSTART:20091101T020000' . "\r\n" . 'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11' . "\r\n" . 'TZOFFSETFROM:-0400' . "\r\n" . 'TZOFFSETTO:-0500' . "\r\n" . 'TZNAME:EST' . "\r\n" . 'END:STANDARD' . "\r\n" . 'BEGIN:DAYLIGHT' . "\r\n" . 'DTSTART:20090301T020000' . "\r\n" . 'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3' . "\r\n" . 'TZOFFSETFROM:-0500' . "\r\n" . 'TZOFFSETTO:-0400' . "\r\n" . 'TZNAME:EDST' . "\r\n" . 'END:DAYLIGHT' . "\r\n" . 'END:VTIMEZONE' . "\r\n" . 'BEGIN:VEVENT' . "\r\n" . 'ORGANIZER;CN="' . $from_name . '":MAILTO:' . $from_address . "\r\n" . 'ATTENDEE;CN="' . $to_name . '";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:' . $to_address . "\r\n" . 'LAST-MODIFIED:' . date("Ymd\\TGis") . "\r\n" . 'UID:' . date("Ymd\\TGis", strtotime($startTime)) . rand() . "@" . $domain . "\r\n" . 'DTSTAMP:' . date("Ymd\\TGis") . "\r\n" . 'DTSTART;TZID="Eastern Time":' . date("Ymd\\THis", strtotime($startTime)) . "\r\n" . 'DTEND;TZID="Eastern Time":' . date("Ymd\\THis", strtotime($endTime)) . "\r\n" . 'TRANSP:OPAQUE' . "\r\n" . 'SEQUENCE:1' . "\r\n" . 'SUMMARY:' . $subject . "\r\n" . 'LOCATION:' . $location . "\r\n" . 'CLASS:PUBLIC' . "\r\n" . 'PRIORITY:5' . "\r\n" . 'BEGIN:VALARM' . "\r\n" . 'TRIGGER:-PT15M' . "\r\n" . 'ACTION:DISPLAY' . "\r\n" . 'DESCRIPTION:Reminder' . "\r\n" . 'END:VALARM' . "\r\n" . 'END:VEVENT' . "\r\n" . 'END:VCALENDAR' . "\r\n";
$message .= 'Content-Type: text/calendar;name="meeting.ics";method=REQUEST' . "\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= $ical;
$mailsent = mail($to_address, $subject, $message, $headers);
return $mailsent ? true : false;
}
示例2: sendCalendarInvite
/**
* @param Schedule $schedule
* @return bool
* @throws \yii\web\BadRequestHttpException
*/
public static function sendCalendarInvite($schedule)
{
if ($schedule->className() !== Schedule::className()) {
throw new BadRequestHttpException('Invalid request');
}
//Create Email Headers
$mime_boundary = '----Meeting Booking----' . MD5(TIME());
$headers = "From: " . self::$from_name . " <" . self::$from_address . ">\n";
$headers .= "Reply-To: " . self::$from_name . " <" . self::$from_address . ">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"\n";
$headers .= "Content-class: urn:content-classes:calendarmessage\n";
//Create Email Body (HTML)
$message = "--{$mime_boundary}\r\n";
$message .= "Content-Type: text/html; charset=UTF-8\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= "<html>\n";
$message .= "<body>\n";
$message .= '<p>' . $schedule->description . '</p>';
$message .= "<h4>Tickets:</h4>\n";
$message .= "<ul>\n";
foreach ($schedule->notes as $note) {
$message .= '<li>' . Html::a($note->ticket->fullName, Url::base(true) . Url::to(['/ticket/view', 'id' => $note->ticket_id])) . "</li>\n";
}
$message .= "</ul>\n";
$message .= '(' . Html::a('view calendar event', Url::to(['/schedule/view', 'id' => $schedule->id], true)) . ")\n";
$message .= "</body>\n";
$message .= "</html>\n";
$message .= "--{$mime_boundary}\r\n";
$message .= 'Content-Type: text/calendar;name="meeting.ics";method=REQUEST' . "\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= 'BEGIN:VCALENDAR' . "\r\n" . 'METHOD:REQUEST' . "\r\n" . 'PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN' . "\r\n" . 'VERSION:2.0' . "\r\n" . 'BEGIN:VTIMEZONE' . "\r\n" . 'TZID:Pacific Standard Time' . "\r\n" . 'BEGIN:STANDARD' . "\r\n" . 'DTSTART:16010101T020000' . "\r\n" . 'TZOFFSETFROM:-0700' . "\r\n" . 'TZOFFSETTO:-0800' . "\r\n" . 'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11' . "\r\n" . 'END:STANDARD' . "\r\n" . 'BEGIN:DAYLIGHT' . "\r\n" . 'DTSTART:16010101T020000' . "\r\n" . 'TZOFFSETFROM:-0800' . "\r\n" . 'TZOFFSETTO:-0700' . "\r\n" . 'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3' . "\r\n" . 'END:DAYLIGHT' . "\r\n" . 'END:VTIMEZONE' . "\r\n" . 'BEGIN:VEVENT' . "\r\n" . 'ORGANIZER;CN="' . $schedule->createdBy->name . '":MAILTO:' . self::$from_address . "\r\n" . 'ATTENDEE;CN="' . $schedule->tech->name . '";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:' . $schedule->tech->email . "\r\n" . 'LAST-MODIFIED:' . date("Ymd\\TGis") . "\r\n" . 'UID:' . date("Ymd\\TGis", strtotime($schedule->start_time)) . rand() . "@" . self::$domain . "\r\n" . 'DTSTAMP:' . date("Ymd\\TGis") . "\r\n" . 'DTSTART;TZID="Pacific Standard Time":' . date("Ymd\\THis", strtotime($schedule->start_time)) . "\r\n" . 'DTEND;TZID="Pacific Standard Time":' . date("Ymd\\THis", strtotime($schedule->endTime)) . "\r\n" . 'TRANSP:OPAQUE' . "\r\n" . 'SEQUENCE:1' . "\r\n" . 'SUMMARY:' . $schedule->invoice->location->fullName . "\r\n" . 'LOCATION:' . $schedule->invoice->location->address . "\r\n" . 'CLASS:PUBLIC' . "\r\n" . 'PRIORITY:5' . "\r\n" . 'BEGIN:VALARM' . "\r\n" . 'TRIGGER:-PT60M' . "\r\n" . 'ACTION:DISPLAY' . "\r\n" . 'DESCRIPTION:Reminder' . "\r\n" . 'END:VALARM' . "\r\n" . 'END:VEVENT' . "\r\n" . 'END:VCALENDAR' . "\r\n";
return self::send($schedule->tech->email, $schedule->invoice->location->fullName, $message, $headers);
}
示例3: closeSession
public function closeSession()
{
$_SESSION["user"] = new CocoasUser();
foreach ($_COOKIE as $key => $value) {
SETCOOKIE($key, $value, TIME() - 10000);
}
}
示例4: TIME_AGO
public static function TIME_AGO($T, $R)
{
if (STRPOS($T, ':') !== FALSE) {
$T = STRTOTIME($T);
}
$C = TIME();
$D = $C - $T;
$P = array('second', 'minute', 'hour', 'day', 'week', 'month', 'year', 'decade');
$L = array(1, 60, 3600, 86400, 604800, 2630880, 31570560, 315705600);
for ($V = SIZEOF($L) - 1; $V >= 0 && ($N = $D / $L[$V]) <= 1; $V--) {
}
if ($V < 0) {
$V = 0;
}
$_T = $C - $D % $L[$V];
$N = FLOOR($N);
if ($N != 1) {
$P[$V] .= 's';
}
$X = SPRINTF("%d %s ", $N, $P[$V]);
if ($R == 1 && $V >= 1 && $C - $_T > 0) {
$X .= self::TIME_AGO($_T);
}
return $X;
}
示例5: testCaseSensitivity
/**
* Tests case insensitive mocks.
*
* @param string $mockName The mock function name.
*
* @test
* @dataProvider provideTestCaseSensitivity
*/
public function testCaseSensitivity($mockName)
{
$builder = new MockBuilder();
$builder->setNamespace(__NAMESPACE__)->setName($mockName)->setFunctionProvider(new FixedValueFunction(1234));
$this->mock = $builder->build();
$this->mock->enable();
$this->assertEquals(1234, time(), "time() is not mocked");
$this->assertEquals(1234, Time(), "Time() is not mocked");
$this->assertEquals(1234, TIME(), "TIME() is not mocked");
}
示例6: getPreName
function getPreName($argv)
{
global $pdo;
$timestart = time();
$consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]);
$namefixer = new NameFixer(['Settings' => $pdo, 'ConsoleTools' => $consoletools]);
$res = false;
if (isset($argv[1]) && $argv[1] === "all") {
$res = $pdo->queryDirect('SELECT id AS releaseid, name, searchname, groupid, categoryid, dehashstatus FROM releases WHERE prehashid = 0 AND ishashed = 1');
} else {
if (isset($argv[1]) && $argv[1] === "full") {
$res = $pdo->queryDirect('SELECT id AS releaseid, name, searchname, groupid, categoryid, dehashstatus FROM releases WHERE categoryid = 8020 AND ishashed = 1 AND dehashstatus BETWEEN -6 AND 0');
} else {
if (isset($argv[1]) && is_numeric($argv[1])) {
$res = $pdo->queryDirect('SELECT id AS releaseid, name, searchname, groupid, categoryid, dehashstatus FROM releases WHERE categoryid = 8020 AND ishashed = 1 AND dehashstatus BETWEEN -6 AND 0 ORDER BY postdate DESC LIMIT ' . $argv[1]);
}
}
}
$counter = $counted = $total = 0;
if ($res !== false) {
$total = $res->rowCount();
}
$show = !isset($argv[2]) || $argv[2] !== 'show' ? 0 : 1;
if ($total > 0) {
echo $pdo->log->header("\n" . number_format($total) . ' releases to process.');
sleep(2);
foreach ($res as $row) {
$success = 0;
if (preg_match('/[a-fA-F0-9]{32,40}/i', $row['name'], $matches)) {
$success = $namefixer->matchPredbHash($matches[0], $row, 1, 1, true, $show);
} else {
if (preg_match('/[a-fA-F0-9]{32,40}/i', $row['searchname'], $matches)) {
$success = $namefixer->matchPredbHash($matches[0], $row, 1, 1, true, $show);
}
}
if ($success === 0) {
$pdo->queryDirect(sprintf('UPDATE releases SET dehashstatus = dehashstatus - 1 WHERE id = %d', $row['releaseid']));
} else {
$counted++;
}
if ($show === 0) {
$consoletools->overWritePrimary("Renamed Releases: [" . number_format($counted) . "] " . $consoletools->percentString(++$counter, $total));
}
}
}
if ($total > 0) {
echo $pdo->log->header("\nRenamed " . $counted . " releases in " . $consoletools->convertTime(TIME() - $timestart) . ".");
} else {
echo $pdo->log->info("\nNothing to do.");
}
}
示例7: reCategorize
function reCategorize($argv)
{
global $pdo;
$where = '';
$othercats = Category::getCategoryOthersGroup();
$update = true;
if (isset($argv[1]) && is_numeric($argv[1])) {
$where = ' AND group_id = ' . $argv[1];
} else {
if (isset($argv[1]) && preg_match('/\\([\\d, ]+\\)/', $argv[1])) {
$where = ' AND group_id IN ' . $argv[1];
} else {
if (isset($argv[1]) && $argv[1] === 'misc') {
$where = sprintf(' AND categoryid IN (%s)', $othercats);
}
}
}
if (isset($argv[2]) && $argv[2] === 'test') {
$update = false;
}
if (isset($argv[1]) && (is_numeric($argv[1]) || preg_match('/\\([\\d, ]+\\)/', $argv[1]))) {
echo $pdo->log->header("Categorizing all releases in {$argv[1]} using searchname. This can take a while, be patient.");
} else {
if (isset($argv[1]) && $argv[1] == "misc") {
echo $pdo->log->header("Categorizing all releases in misc categories using searchname. This can take a while, be patient.");
} else {
echo $pdo->log->header("Categorizing all releases using searchname. This can take a while, be patient.");
}
}
$timestart = TIME();
if (isset($argv[1]) && (is_numeric($argv[1]) || preg_match('/\\([\\d, ]+\\)/', $argv[1])) || $argv[1] === 'misc') {
$chgcount = categorizeRelease(str_replace(" AND", "WHERE", $where), $update, true);
} else {
$chgcount = categorizeRelease('', $update, true);
}
$consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]);
$time = $consoletools->convertTime(TIME() - $timestart);
if ($update === true) {
echo $pdo->log->header("Finished re-categorizing " . number_format($chgcount) . " releases in " . $time . " , using the searchname.\n");
} else {
echo $pdo->log->header("Finished re-categorizing in " . $time . " , using the searchname.\n" . "This would have changed " . number_format($chgcount) . " releases but no updates were done.\n");
}
}
示例8: reCategorize
function reCategorize($argv)
{
$c = new ColorCLI();
$where = '';
$update = true;
if (isset($argv[1]) && is_numeric($argv[1])) {
$where = ' AND groupid = ' . $argv[1];
} else {
if (isset($argv[1]) && preg_match('/\\([\\d, ]+\\)/', $argv[1])) {
$where = ' AND groupid IN ' . $argv[1];
} else {
if (isset($argv[1]) && $argv[1] === 'misc') {
$where = ' AND categoryid IN (1090, 2020, 3050, 4040, 5050, 6050, 7050, 8010)';
}
}
}
if (isset($argv[2]) && $argv[2] === 'test') {
$update = false;
}
if (isset($argv[1]) && (is_numeric($argv[1]) || preg_match('/\\([\\d, ]+\\)/', $argv[1]))) {
echo $c->header("Categorizing all releases in {$argv[1]} using searchname. This can take a while, be patient.");
} else {
if (isset($argv[1]) && $argv[1] == "misc") {
echo $c->header("Categorizing all releases in misc categories using searchname. This can take a while, be patient.");
} else {
echo $c->header("Categorizing all releases using searchname. This can take a while, be patient.");
}
}
$timestart = TIME();
if (isset($argv[1]) && (is_numeric($argv[1]) || preg_match('/\\([\\d, ]+\\)/', $argv[1])) || $argv[1] === 'misc') {
$chgcount = categorizeRelease($update, str_replace(" AND", "WHERE", $where), true);
} else {
$chgcount = categorizeRelease($update, "", true);
}
$consoletools = new ConsoleTools();
$time = $consoletools->convertTime(TIME() - $timestart);
if ($update === true) {
echo $c->header("Finished re-categorizing " . number_format($chgcount) . " releases in " . $time . " , \tusing the searchname.\n");
} else {
echo $c->header("Finished re-categorizing in " . $time . " , using the searchname.\n" . "This would have changed " . number_format($chgcount) . " releases but no updates were done.\n");
}
}
示例9: build_page
public function build_page()
{
$fp = fopen("../" . PAGES_DIRECTORY . "/hello-world.php", 'w');
if ($fp) {
$content = sprintf($this->file_content, '1');
fwrite($fp, $content, strlen($content));
fclose($fp);
}
$values = array('page_id' => 1, 'position' => 1, 'module' => "wrapper", 'block' => 1);
$this->query_str = $this->__build_insert("sections", $values);
$this->db->query($this->query_str);
$this->__test_error();
$values = array('section_id' => 1, 'page_id' => 1, 'url' => $this->url, 'height' => "800");
$this->query_str = $this->__build_insert("mod_wrapper", $values);
$this->db->query($this->query_str);
$this->__test_error();
$values = array('link' => "/hello-world", 'page_title' => "hello world", 'menu_title' => "hello world", 'page_trail' => 1, 'root_parent' => 1, 'searching' => 1, 'admin_groups' => 1, 'viewing_groups' => 1, 'modified_by' => 1, 'modified_when' => TIME(), 'language' => $this->language, 'visibility' => 'public', 'menu' => '1', 'target' => '_new', 'description' => '', 'keywords' => '', 'admin_users' => '', 'viewing_users' => '');
$this->query_str = $this->__build_insert("pages", $values);
$this->db->query($this->query_str);
$this->__test_error();
}
示例10: respond
public function respond()
{
global $_W;
$rid = $this->rule;
$from = $this->message['from'];
$message = $this->message['content'];
$sql = "SELECT * FROM " . tablename($this->tabl_vote) . " WHERE `rid`=:rid LIMIT 1";
$row = pdo_fetch($sql, array(':rid' => $rid));
$now = TIME();
$info = json_decode($row['config']);
$res = json_decode($row['result']);
if ($now >= $row['start_time'] && $now <= $row['end_time']) {
if ($this->inContext) {
if (is_numeric((int) $message) && ((int) $message >= 1 && (int) $message <= count($info))) {
$res[$message - 1]++;
$_res = json_encode($res);
$insert = array('result' => $_res);
pdo_update($this->tabl_vote, $insert, array('id' => $row['id']));
$this->endContext();
$reply = "你投票给了{$message} 共有 ({$res[$message - 1]}) 谢谢您!";
} else {
$reply = "你的投票无效!";
}
return $this->respText($reply);
} else {
$_info = "本次投票选项:\r\n";
foreach ($info as $k => $v) {
$_info .= $k + 1 . '.' . $v . "({$res[$k]})\r\n";
}
$_info .= "回复相应数字进行投票!";
$reply = $_info;
$this->beginContext(3600);
return $this->respText($reply);
}
} else {
$reply = $rid . "亲,投票活动已结束了!";
return $this->respText($reply);
}
// 返回至系统
}
示例11: relativeTime
function relativeTime($_time)
{
$d = array();
$d[0] = array(1, "sec");
$d[1] = array(60, "min");
$d[2] = array(3600, "hr");
$d[3] = array(86400, "day");
$d[4] = array(31104000, "yr");
$w = array();
$return = "";
$now = TIME();
$diff = $now - $_time;
$secondsLeft = $diff;
for ($i = 4; $i > -1; $i--) {
$w[$i] = intval($secondsLeft / $d[$i][0]);
$secondsLeft -= $w[$i] * $d[$i][0];
if ($w[$i] != 0) {
$return .= $w[$i] . " " . $d[$i][1] . ($w[$i] > 1 ? 's' : '') . " ";
}
}
return $return;
}
示例12: mi
public function mi($email = '')
{
$email = strval($email);
if (IS_POST) {
//登录验证
//检测验证码
//根据用户名获取用户UID
$user = Member()->where(array('email' => $email))->find();
$uid = $user['uid'];
if (!$uid) {
$this->error("该邮箱还未注册");
}
//生成找回密码的验证码
$verify = $this->getResetPasswordVerifyCode($uid);
//发送验证邮箱
$url = 'http://' . $_SERVER['HTTP_HOST'] . U('member/reset?uid=' . $uid . '&verify=' . $verify);
$content = C('USER_RESPASS') . "<br/>" . $url . "<br/>" . modC('WEB_SITE_NAME', '音乐人开放平台', 'Config') . "系统自动发送--请勿直接回复<br/>" . date('Y-m-d H:i:s', TIME()) . "</p>";
send_mail($email, modC('WEB_SITE_NAME', '音乐人开放平台', 'Config') . "密码找回", $content);
$this->success('重设密码邮件发送成功,请注意查收');
} else {
$this->display();
}
}
示例13: foreach
foreach ($collections_rows as $row) {
$groupName = $groups->getByNameByID($row['group_id']);
echo $pdo->log->header("Processing {$groupName}");
//collection
$pdo->queryExec("INSERT IGNORE INTO collections_" . $row['group_id'] . " (subject, fromname, date, xref, totalfiles, group_id, collectionhash, dateadded, filecheck, filesize, releaseid) " . "SELECT subject, fromname, date, xref, totalfiles, group_id, collectionhash, dateadded, filecheck, filesize, releaseid FROM collections WHERE group_id = {$row['group_id']}");
$collections = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM collections where group_id = " . $row['group_id']);
$ncollections = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM collections_" . $row['group_id']);
echo $pdo->log->primary("Group {$groupName}, Collections = {$collections['cnt']} [{$ncollections['cnt']}]");
//binaries
$pdo->queryExec("INSERT IGNORE INTO binaries_{$row['group_id']} (name, filenumber, totalparts, currentparts, binaryhash, partcheck, partsize, collection_id) " . "SELECT name, filenumber, totalparts, currentparts, binaryhash, partcheck, partsize, n.id FROM binaries b " . "INNER JOIN collections c ON b.collection_id = c.id " . "INNER JOIN collections_{$row['group_id']} n ON c.collectionhash = n.collectionhash AND c.group_id = {$row['group_id']}");
$binaries = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM binaries b INNER JOIN collections c ON b.collection_id = c.id where c.group_id = {$row['group_id']}");
$nbinaries = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM binaries_{$row['group_id']}");
echo $pdo->log->primary("Group {$groupName}, Binaries = {$binaries['cnt']} [{$nbinaries['cnt']}]");
//parts
$pdo->queryExec("INSERT IGNORE INTO parts_{$row['group_id']} (messageid, number, partnumber, size, binaryid, collection_id) " . "SELECT messageid, number, partnumber, size, n.id, c.id FROM parts p " . "INNER JOIN binaries b ON p.binaryid = b.id " . "INNER JOIN binaries_{$row['group_id']} n ON b.binaryhash = n.binaryhash " . "INNER JOIN collections_{$row['group_id']} c on c.id = n.collection_id AND c.group_id = {$row['group_id']}");
$parts = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM parts p INNER JOIN binaries b ON p.binaryid = b.id INNER JOIN collections c ON b.collection_id = c.id WHERE c.group_id = {$row['group_id']}");
$nparts = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM parts_{$row['group_id']}");
echo $pdo->log->primary("Group {$groupName}, Parts = {$parts['cnt']} [{$nparts['cnt']}]\n");
$i++;
}
}
if (isset($argv[2]) && $argv[2] == 'truncate') {
echo $pdo->log->info("Truncating collections, binaries and parts tables.");
$pdo->queryExec("TRUNCATE TABLE collections");
$pdo->queryExec("TRUNCATE TABLE binaries");
$pdo->queryExec("TRUNCATE TABLE parts");
}
//set tpg active
$pdo->queryExec("UPDATE settings SET value = 1 WHERE setting = 'tablepergroup'");
echo $pdo->log->header("Processed: {$i} groups and " . number_format($parts_count['cnt']) . " parts in " . $consoleTools->convertTimer(TIME() - $start));
示例14: catch
@$todo($file);
}
}
} catch (UnexpectedValueException $e) {
echo $pdo->log->error($e->getMessage());
}
echo $pdo->log->header("Deleting all images, previews and samples that still remain.");
try {
$dirItr = new \RecursiveDirectoryIterator(nZEDb_COVERS);
$itr = new \RecursiveIteratorIterator($dirItr, \RecursiveIteratorIterator::LEAVES_ONLY);
foreach ($itr as $filePath) {
if (basename($filePath) != '.gitignore' && basename($filePath) != 'no-cover.jpg' && basename($filePath) != 'no-backdrop.jpg') {
@unlink($filePath);
}
}
} catch (UnexpectedValueException $e) {
echo $pdo->log->error($e->getMessage());
}
echo $pdo->log->header("Getting Updated List of TV Shows from TVRage.");
$tvshows = @simplexml_load_file('http://services.tvrage.com/feeds/show_list.php');
if ($tvshows !== false) {
foreach ($tvshows->show as $rage) {
if (isset($rage->id) && isset($rage->name) && !empty($rage->id) && !empty($rage->name)) {
$pdo->queryInsert(sprintf('INSERT INTO tvrage_titles (rageid, releasetitle, country) VALUES (%s, %s, %s)', $pdo->escapeString($rage->id), $pdo->escapeString($rage->name), $pdo->escapeString($rage->country)));
}
}
} else {
echo $pdo->log->error("TVRage site has a hard limit of 400 concurrent api requests. At the moment, they have reached that limit. Please wait before retrying again.");
}
echo $pdo->log->header("Deleted all releases, images, previews and samples. This script ran for " . $consoletools->convertTime(TIME() - $timestart));
示例15: removeCrap
//.........这里部分代码省略.........
public function removeCrap($delete, $time, $type = '', $blacklistID = '')
{
$this->timeStart = time();
$this->delete = $delete;
$this->blacklistID = '';
if (isset($blacklistID) && is_numeric($blacklistID)) {
$this->blacklistID = sprintf("AND id = %d", $blacklistID);
}
$time = trim($time);
$this->crapTime = '';
$type = strtolower(trim($type));
switch ($time) {
case 'full':
if ($this->echoCLI) {
echo $this->pdo->log->header("Removing " . ($type == '' ? "All crap releases " : $type . " crap releases") . " - no time limit.\n");
}
break;
default:
if (!is_numeric($time)) {
$this->error = 'Error, time must be a number or full.';
return $this->returnError();
}
if ($this->echoCLI) {
echo $this->pdo->log->header("Removing " . ($type == '' ? "All crap releases " : $type . " crap releases") . " from the past " . $time . " hour(s).\n");
}
$this->crapTime = ' AND r.adddate > (NOW() - INTERVAL ' . $time . ' HOUR)';
break;
}
$this->deletedCount = 0;
switch ($type) {
case 'blacklist':
$this->removeBlacklist();
break;
case 'blfiles':
$this->removeBlacklistFiles();
break;
case 'executable':
$this->removeExecutable();
break;
case 'gibberish':
$this->removeGibberish();
break;
case 'hashed':
$this->removeHashed();
break;
case 'installbin':
$this->removeInstallBin();
break;
case 'passworded':
$this->removePassworded();
break;
case 'passwordurl':
$this->removePasswordURL();
break;
case 'sample':
$this->removeSample();
break;
case 'scr':
$this->removeSCR();
break;
case 'short':
$this->removeShort();
break;
case 'size':
$this->removeSize();
break;
case 'huge':
$this->removeHuge();
break;
case 'codec':
$this->removeCodecPoster();
break;
case 'wmv_all':
$this->removeWMV();
break;
case '':
$this->removeBlacklist();
$this->removeBlacklistFiles();
$this->removeExecutable();
$this->removeGibberish();
$this->removeHashed();
$this->removeInstallBin();
$this->removePassworded();
$this->removeSample();
$this->removeSCR();
$this->removeShort();
$this->removeSize();
$this->removeHuge();
$this->removeCodecPoster();
break;
default:
$this->error = 'Wrong type: ' . $type;
return $this->returnError();
}
if ($this->echoCLI) {
echo $this->pdo->log->headerOver(($this->delete ? "Deleted " : "Would have deleted ") . $this->deletedCount . " release(s). This script ran for ");
echo $this->pdo->log->header($this->consoleTools->convertTime(TIME() - $this->timeStart));
}
return $this->browser ? 'Success! ' . ($this->delete ? "Deleted " : "Would have deleted ") . $this->deletedCount . ' release(s) in ' . $this->consoleTools->convertTime(TIME() - $this->timeStart) : true;
}