本文整理汇总了PHP中GO::setMemoryLimit方法的典型用法代码示例。如果您正苦于以下问题:PHP GO::setMemoryLimit方法的具体用法?PHP GO::setMemoryLimit怎么用?PHP GO::setMemoryLimit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GO
的用法示例。
在下文中一共展示了GO::setMemoryLimit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render($return = false)
{
\GO::setMemoryLimit(512);
$this->_pdf = new Pdf('L');
// $this->_pdf->font_size=8;
$this->_pdf->title = $this->name();
if ($this->project) {
$this->_pdf->title .= ': ' . $this->project->path;
}
if (!empty($_REQUEST['startdate'])) {
$this->_pdf->subtitle = $_REQUEST['startdate'];
if (!empty($_REQUEST['enddate'])) {
$this->_pdf->subtitle .= " - " . $_REQUEST['enddate'];
}
}
$this->_pdf->AddPage();
$this->_addProjects();
if ($return) {
return $this->_pdf->Output($this->filename . ".pdf", 'I');
} else {
Http::outputDownloadHeaders(new File($this->filename . ".pdf"));
echo $this->_pdf->Output($this->filename . ".pdf", 'I');
}
}
示例2: actionRemoveDuplicates
public function actionRemoveDuplicates($params)
{
\GO::setMaxExecutionTime(300);
\GO::setMemoryLimit(1024);
$this->render('externalHeader');
$tasklist = \GO\Tasks\Model\Tasklist::model()->findByPk($params['tasklist_id']);
if (!$tasklist) {
throw new \GO\Base\Exception\NotFound();
}
\GO\Base\Fs\File::setAllowDeletes(false);
//VERY IMPORTANT:
\GO\Files\Model\Folder::$deleteInDatabaseOnly = true;
\GO::session()->closeWriting();
//close writing otherwise concurrent requests are blocked.
$checkModels = array("GO\\Tasks\\Model\\Task" => array('name', 'start_time', 'due_time', 'rrule', 'user_id', 'tasklist_id'));
foreach ($checkModels as $modelName => $checkFields) {
if (empty($params['model']) || $modelName == $params['model']) {
echo '<h1>' . \GO::t('removeDuplicates') . '</h1>';
$checkFieldsStr = 't.' . implode(', t.', $checkFields);
$findParams = \GO\Base\Db\FindParams::newInstance()->ignoreAcl()->select('t.id, count(*) AS n, ' . $checkFieldsStr)->group($checkFields)->having('n>1');
$findParams->getCriteria()->addCondition('tasklist_id', $tasklist->id);
$stmt1 = \GO::getModel($modelName)->find($findParams);
echo '<table border="1">';
echo '<tr><td>ID</th><th>' . implode('</th><th>', $checkFields) . '</th></tr>';
$count = 0;
while ($dupModel = $stmt1->fetch()) {
$select = 't.id';
if (\GO::getModel($modelName)->hasFiles()) {
$select .= ', t.files_folder_id';
}
$findParams = \GO\Base\Db\FindParams::newInstance()->ignoreAcl()->select($select . ', ' . $checkFieldsStr)->order('id', 'ASC');
$findParams->getCriteria()->addCondition('tasklist_id', $tasklist->id);
foreach ($checkFields as $field) {
$findParams->getCriteria()->addCondition($field, $dupModel->getAttribute($field));
}
$stmt = \GO::getModel($modelName)->find($findParams);
$first = true;
while ($model = $stmt->fetch()) {
echo '<tr><td>';
if (!$first) {
echo '<span style="color:red">';
}
echo $model->id;
if (!$first) {
echo '</span>';
}
echo '</th>';
foreach ($checkFields as $field) {
echo '<td>' . $model->getAttribute($field, 'html') . '</td>';
}
echo '</tr>';
if (!$first) {
if (!empty($params['delete'])) {
if ($model->hasLinks() && $model->countLinks()) {
echo '<tr><td colspan="99">' . \GO::t('skippedDeleteHasLinks') . '</td></tr>';
} elseif (($filesFolder = $model->getFilesFolder(false)) && ($filesFolder->hasFileChildren() || $filesFolder->hasFolderChildren())) {
echo '<tr><td colspan="99">' . \GO::t('skippedDeleteHasFiles') . '</td></tr>';
} else {
$model->delete();
}
}
$count++;
}
$first = false;
}
}
echo '</table>';
echo '<p>' . sprintf(\GO::t('foundDuplicates'), $count) . '</p>';
echo '<br /><br /><a href="' . \GO::url('tasks/tasklist/removeDuplicates', array('delete' => true, 'tasklist_id' => $tasklist->id)) . '">' . \GO::t('clickToDeleteDuplicates') . '</a>';
}
}
$this->render('externalFooter');
}