Skip to content

Commit

Permalink
v23.0.5
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed Jun 2, 2022
1 parent 3725f37 commit 2090802
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 8 deletions.
4 changes: 2 additions & 2 deletions OCP/AppFramework/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ public function __construct() {
* @return $this
* @since 6.0.0 - return value was added in 7.0.0
*/
public function cacheFor(int $cacheSeconds, bool $public = false) {
public function cacheFor(int $cacheSeconds, bool $public = false, bool $immutable = false) {
if ($cacheSeconds > 0) {
$pragma = $public ? 'public' : 'private';
$this->addHeader('Cache-Control', $pragma . ', max-age=' . $cacheSeconds . ', must-revalidate');
$this->addHeader('Cache-Control', sprintf('%s, max-age=%s, %s', $pragma, $cacheSeconds, ($immutable ? 'immutable' : 'must-revalidate')));
$this->addHeader('Pragma', $pragma);

// Set expires header
Expand Down
9 changes: 9 additions & 0 deletions OCP/BackgroundJob/IJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
* @since 7.0.0
*/
interface IJob {
/**
* @since 24.0.0
*/
public const TIME_INSENSITIVE = 0;
/**
* @since 24.0.0
*/
public const TIME_SENSITIVE = 1;

/**
* Run the background job with the registered argument
*
Expand Down
5 changes: 3 additions & 2 deletions OCP/BackgroundJob/IJobList.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ public function getAll();
/**
* get the next job in the list
*
* @param bool $onlyTimeSensitive
* @return \OCP\BackgroundJob\IJob|null
* @since 7.0.0
* @since 7.0.0 - In 24.0.0 parameter $onlyTimeSensitive got added
*/
public function getNext();
public function getNext(bool $onlyTimeSensitive = false): ?IJob;

/**
* @param int $id
Expand Down
32 changes: 32 additions & 0 deletions OCP/BackgroundJob/TimedJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
abstract class TimedJob extends Job {
/** @var int */
protected $interval = 0;
/** @var int */
protected $timeSensitivity = IJob::TIME_SENSITIVE;

/**
* set the interval for the job
Expand All @@ -50,6 +52,36 @@ public function setInterval(int $seconds) {
$this->interval = $seconds;
}

/**
* Whether the background job is time sensitive and needs to run soon after
* the scheduled interval, of if it is okay to be delayed until a later time.
*
* @return bool
* @since 24.0.0
*/
public function isTimeSensitive(): bool {
return $this->timeSensitivity === IJob::TIME_SENSITIVE;
}

/**
* If your background job is not time sensitive (sending instant email
* notifications, etc.) it would be nice to set it to IJob::TIME_INSENSITIVE
* This way the execution can be delayed during high usage times.
*
* @param int $sensitivity
* @psalm-param IJob::TIME_* $sensitivity
* @return void
* @since 24.0.0
*/
public function setTimeSensitivity(int $sensitivity): void {
if ($sensitivity !== IJob::TIME_SENSITIVE &&
$sensitivity !== IJob::TIME_INSENSITIVE) {
throw new \InvalidArgumentException('Invalid sensitivity');
}

$this->timeSensitivity = $sensitivity;
}

/**
* run the job if the last run is is more than the interval ago
*
Expand Down
2 changes: 1 addition & 1 deletion OCP/DB/QueryBuilder/IQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ public function orderBy($sort, $order = null);
/**
* Adds an ordering to the query results.
*
* @param string $sort The ordering expression.
* @param string|ILiteral|IParameter|IQueryFunction $sort The ordering expression.
* @param string $order The ordering direction.
*
* @return $this This QueryBuilder instance.
Expand Down
35 changes: 35 additions & 0 deletions OCP/Files/Storage/IReliableEtagStorage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Robin Appelman <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCP\Files\Storage;

/**
* Marks a storage as providing reliable etags according to expected behavior of etags within nextcloud:
*
* - Etag are stable as long as no changes are made to the files
* - Changes inside a folder cause etag changes of the parent folders
*
* @since 23.0.4
*/
interface IReliableEtagStorage extends IStorage {
}
4 changes: 2 additions & 2 deletions OCP/IAvatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
*/
namespace OCP;

use OCP\Files\File;
use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFile;

/**
* This class provides avatar functionality
Expand Down Expand Up @@ -80,7 +80,7 @@ public function remove();
/**
* Get the file of the avatar
* @param int $size -1 can be used to not scale the image
* @return File
* @return ISimpleFile
* @throws NotFoundException
* @since 9.0.0
*/
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

rm -rf OCP
git clone --depth 1 --branch stable23 https:/nextcloud/server.git
git clone --depth 1 --branch v23.0.5 https:/nextcloud/server.git
cp -r server/lib/public OCP
rm -rf server
git add OCP

0 comments on commit 2090802

Please sign in to comment.