本文整理汇总了PHP中GO::setMaxExecutionTime方法的典型用法代码示例。如果您正苦于以下问题:PHP GO::setMaxExecutionTime方法的具体用法?PHP GO::setMaxExecutionTime怎么用?PHP GO::setMaxExecutionTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GO
的用法示例。
在下文中一共展示了GO::setMaxExecutionTime方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
protected function init()
{
\GO::$disableModelCache = true;
//for less memory usage
\GO::setMaxExecutionTime(0);
//allow long runs
GO::setMemoryLimit(256);
ini_set('display_errors', 'on');
}
示例2: _processExport
private function _processExport($data)
{
\GO::setMaxExecutionTime(0);
$className = $data['savedExportModel']->class_name;
$class = new $className($data['savedExportModel']->export_columns);
// Get the model for this export
$this->_model = $class->getModel();
// Translate orientation from horizontal/vertical to landscape/portrait
$this->_orientation = $data['savedExportModel']->orientation === 'H' ? 'L' : 'P';
// Retreive the name of the file
$this->_title = $class->getName();
// Show the headers in the export (could be 1 instead of true or 0 instead of false)
$this->_showHeader = $data['savedExportModel']->include_column_names == true ? true : false;
// Use database column names or human readable column names
$this->_humanHeaders = $data['savedExportModel']->use_db_column_names == true ? false : true;
// Get the findparams for the export
$this->_findParams = $class->getFindParams();
// Create the column model
$this->_columnModel = $class->getColumnModel();
// Create the store for this export
$this->_store = $class->getStore();
}
示例3: actionDownload
protected function actionDownload($params)
{
\GO::session()->closeWriting();
\GO::setMaxExecutionTime(0);
if (isset($params['path'])) {
$folder = \GO\Files\Model\Folder::model()->findByPath(dirname($params['path']));
$file = $folder->hasFile(\GO\Base\Fs\File::utf8Basename($params['path']));
} else {
$file = \GO\Files\Model\File::model()->findByPk($params['id'], false, true);
}
if (!$file) {
throw new \GO\Base\Exception\NotFound();
}
if (!empty($params['random_code'])) {
if ($file->random_code != $params['random_code']) {
throw new \GO\Base\Exception\NotFound();
}
if (time() > $file->expire_time) {
throw new \Exception(\GO::t('downloadLinkExpired', 'files'));
}
} else {
$public = substr($file->path, 0, 6) == 'public';
if (!$public) {
if (!\GO::user()) {
\GO\Base\Util\Http::basicAuth();
}
if (!$file->checkPermissionLevel(\GO\Base\Model\Acl::READ_PERMISSION)) {
throw new \GO\Base\Exception\AccessDenied();
}
}
}
// Show the file inside the browser or give it as a download
$inline = true;
// Defaults to show inside the browser
if (isset($params['inline']) && $params['inline'] == "false") {
$inline = false;
}
\GO\Base\Util\Http::outputDownloadHeaders($file->fsFile, $inline, !empty($params['cache']));
$file->open();
$this->fireEvent('beforedownload', array(&$this, &$params, &$file));
$file->fsFile->output();
}
示例4: 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');
}
示例5: actionImport
/**
* The function that will be called when importing users
*
* @param array $params
* @return array
* @throws Exception When the controller cannot be found, an exeption will be thrown
*/
protected function actionImport($params)
{
$response = array();
// $params['updateExisting'] = true;
$params['updateFindAttributes'] = 'username';
$params['file'] = $_FILES['files']['tmp_name'][0];
\GO::setMaxExecutionTime(0);
if ($params['controller'] == 'GO\\Users\\Controller\\UserController') {
$controller = new UserController();
} else {
throw new \Exception("No or wrong controller given");
}
$response = array_merge($response, $controller->run("importCsv", $params, false));
$response['success'] = true;
return $response;
}
示例6: actionImport
/**
*
* Defaults to a CSV import.
*
* Custom fields can be specified in the header with cf\$categoryName\$fieldName
*
* eg. name,attribute,cf\Test\Textfield
*
* Command line:
*
* ./groupoffice biling/order/import --file=/path/to/file.csv --delimiter=, --enclosure="
*
* @param array $params
*/
protected function actionImport($params)
{
$summarylog = new \GO\Base\Component\SummaryLog();
\GO::$disableModelCache = true;
//for less memory usage
\GO::setMaxExecutionTime(0);
\GO::session()->closeWriting();
//close writing otherwise concurrent requests are blocked.
$attributeIndexMap = isset($params['attributeIndexMap']) ? $attributeIndexMap = json_decode($params['attributeIndexMap'], true) : array();
if (is_file($params['file'])) {
if (!isset($params['importType'])) {
$params['importType'] = 'Csv';
}
$fileClassName = 'GO\\Base\\Fs\\' . $params['importType'] . 'File';
if ($params['importType'] == 'Xls' && !empty($params['maxColumnNr'])) {
$importFile = new $fileClassName($params['file'], $params['maxColumnNr']);
} else {
$importFile = new $fileClassName($params['file']);
}
if (!empty($params['delimiter'])) {
$importFile->delimiter = $params['delimiter'];
}
if (!empty($params['enclosure'])) {
$importFile->enclosure = $params['enclosure'];
}
if (php_sapi_name() == 'cli') {
if (!empty($importFile->delimiter)) {
echo "Delimiter: " . $importFile->delimiter . "\n";
}
if (!empty($importFile->enclosure)) {
echo "Enclosure: " . $importFile->enclosure . "\n";
}
echo "File: " . $importFile->path() . "\n\n";
}
if (!$importFile->convertToUtf8()) {
exit("ERROR: Could not convert to UTF8. Is the file writable?\n\n");
}
$headers = $importFile->getRecord();
//Map the field headers to the index in the record.
//eg. name=>2,user_id=>4, etc.
if (empty($attributeIndexMap)) {
for ($i = 0, $m = count($headers); $i < $m; $i++) {
if (substr($headers[$i], 0, 3) == 'cf\\') {
$cf = $this->_resolveCustomField($headers[$i]);
if ($cf) {
$attributeIndexMap[$i] = $cf;
}
} else {
$attributeIndexMap[$i] = $headers[$i];
}
}
}
while ($record = $importFile->getRecord()) {
$attributes = array();
$model = false;
foreach ($attributeIndexMap as $index => $attributeName) {
if ($index >= 0) {
$attributes[trim($attributeName)] = $record[$index];
}
}
if (!empty($params['updateExisting']) && !empty($params['updateFindAttributes'])) {
$findBy = explode(',', $params['updateFindAttributes']);
$attr = array();
foreach ($findBy as $attrib) {
$attr[$attrib] = $attributes[$attrib];
}
$model = \GO::getModel($this->model)->findSingleByAttributes($attr);
}
if (!$model) {
$model = new $this->model();
}
// If there are given baseparams to the importer
if (isset($params['importBaseParams'])) {
$baseParams = json_decode($params['importBaseParams'], true);
foreach ($baseParams as $attr => $val) {
$attributes[$attr] = $val;
}
}
if ($this->beforeImport($params, $model, $attributes, $record)) {
// //Unset some default attributes set in the code
// $defaultAttributes = $model->defaultAttributes();
// foreach($defaultAttributes as $column => $value)
// unset($model->{$column});
$columns = $model->getColumns();
foreach ($columns as $col => $attr) {
if (isset($attributes[$col])) {
//.........这里部分代码省略.........