Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test if set_time_limit exists #5675

Merged
merged 3 commits into from Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/Controllers/entryController.php
Expand Up @@ -169,7 +169,9 @@ public function optimizeAction(): void {
Minz_Request::forward($url_redirect, true);
}

@set_time_limit(300);
if (function_exists('set_time_limit')) {
@set_time_limit(300);
}

$databaseDAO = FreshRSS_Factory::createDatabaseDAO();
$databaseDAO->optimize();
Expand All @@ -188,7 +190,9 @@ public function optimizeAction(): void {
* @todo should be in feedController
*/
public function purgeAction(): void {
@set_time_limit(300);
if (function_exists('set_time_limit')) {
@set_time_limit(300);
}

$feedDAO = FreshRSS_Factory::createFeedDao();
$feeds = $feedDAO->listFeeds();
Expand Down
12 changes: 9 additions & 3 deletions app/Controllers/feedController.php
Expand Up @@ -36,7 +36,9 @@ public function firstAction(): void {
public static function addFeed(string $url, string $title = '', int $cat_id = 0, string $new_cat_name = '',
string $http_auth = '', array $attributes = [], int $kind = FreshRSS_Feed::KIND_RSS): FreshRSS_Feed {
FreshRSS_UserDAO::touch();
@set_time_limit(300);
if (function_exists('set_time_limit')) {
@set_time_limit(300);
}

$catDAO = FreshRSS_Factory::createCategoryDao();

Expand Down Expand Up @@ -329,7 +331,9 @@ public function truncateAction(): void {
*/
public static function actualizeFeed(int $feed_id, string $feed_url, bool $force, ?SimplePie $simplePiePush = null,
bool $noCommit = false, int $maxFeeds = 10): array {
@set_time_limit(300);
if (function_exists('set_time_limit')) {
@set_time_limit(300);
}

$feedDAO = FreshRSS_Factory::createFeedDao();
$entryDAO = FreshRSS_Factory::createEntryDao();
Expand Down Expand Up @@ -875,7 +879,9 @@ public function clearCacheAction(): void {
* @throws FreshRSS_BadUrl_Exception
*/
public function reloadAction(): void {
@set_time_limit(300);
if (function_exists('set_time_limit')) {
@set_time_limit(300);
}

//Get Feed ID.
$feed_id = Minz_Request::paramInt('id');
Expand Down
4 changes: 3 additions & 1 deletion app/Controllers/importExportController.php
Expand Up @@ -182,7 +182,9 @@ public function importAction(): void {
Minz_Request::bad(_t('feedback.import_export.file_cannot_be_uploaded'), [ 'c' => 'importExport', 'a' => 'index' ]);
}

@set_time_limit(300);
if (function_exists('set_time_limit')) {
@set_time_limit(300);
}

$error = false;
try {
Expand Down
4 changes: 3 additions & 1 deletion app/Services/ImportService.php
Expand Up @@ -34,7 +34,9 @@ public function lastStatus(): bool {
* @param bool $dry_run true to not create categories and feeds in database.
*/
public function importOpml(string $opml_file, ?FreshRSS_Category $forced_category = null, bool $dry_run = false): void {
@set_time_limit(300);
if (function_exists('set_time_limit')) {
@set_time_limit(300);
}
$this->lastStatus = true;
$opml_array = [];
try {
Expand Down