Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ on: [push, pull_request]
jobs:
ci:
uses: catalyst/catalyst-moodle-workflows/.github/workflows/ci.yml@main
with:
disable_phpdoc: true
3 changes: 3 additions & 0 deletions classes/azure_file_system.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

use tool_objectfs\local\store\azure\file_system;

/**
* Unknown?
*/
class azure_file_system extends file_system {

}
4 changes: 4 additions & 0 deletions classes/digitalocean_file_system.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@
*
* @package tool_objectfs
* @author Brian Yanosik <kisonay@gmail.com>
* @copyright Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace tool_objectfs;

use tool_objectfs\local\store\digitalocean\file_system;

/**
* Unknown?
*/
class digitalocean_file_system extends file_system {

}
24 changes: 16 additions & 8 deletions classes/local/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@
use stdClass;
use tool_objectfs\local\store\object_file_system;

defined('MOODLE_INTERNAL') || die();

/**
* [Description manager]
*/
class manager {

/**
* @param $config
* set_objectfs_config
* @param stdClass $config
* @return void
*/
public static function set_objectfs_config($config) {
foreach ($config as $key => $value) {
Expand All @@ -42,6 +45,7 @@ public static function set_objectfs_config($config) {
}

/**
* get_objectfs_config
* @return stdClass
* @throws \dml_exception
*/
Expand Down Expand Up @@ -114,8 +118,9 @@ public static function get_objectfs_config() {
}

/**
* @param $config
* @return bool
* get_client
* @param stdClass $config
* @return mixed|bool
*/
public static function get_client($config) {
$clientclass = self::get_client_classname_from_fs($config->filesystem);
Expand All @@ -128,8 +133,9 @@ public static function get_client($config) {
}

/**
* @param $contenthash
* @param $newlocation
* update_object_by_hash
* @param string $contenthash
* @param string $newlocation
* @param int|null $filesize Size of the file in bytes. Falls back to stored value if not provided.
* @return mixed|stdClass
* @throws \dml_exception
Expand Down Expand Up @@ -172,8 +178,9 @@ public static function update_object_by_hash($contenthash, $newlocation, $filesi
}

/**
* update_object
* @param stdClass $object
* @param $newlocation
* @param string $newlocation
* @return stdClass
* @throws \dml_exception
*/
Expand All @@ -192,6 +199,7 @@ public static function update_object(stdClass $object, $newlocation) {
}

/**
* cloudfront_pem_exists
* @return string
* @throws \coding_exception
* @throws \dml_exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
use tool_objectfs\local\object_manipulator\recoverer;
use tool_objectfs\local\object_manipulator\orphaner;

/**
* Candidates Factory
*/
class candidates_factory {

/** @var array $manipulatormap */
Expand All @@ -46,8 +49,10 @@ class candidates_factory {
];

/**
* @param $manipulator
* Finder
* @param mixed $manipulator
* @param stdClass $config
*
* @return mixed
* @throws moodle_exception
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
use moodle_exception;
use stdClass;

/**
* Candidates Finder
*/
class candidates_finder {

/** @var string $finder */
Expand All @@ -43,13 +46,15 @@ public function __construct($manipulator, stdClass $config) {
}

/**
* get
* @return array
*/
public function get() {
return $this->finder->get();
}

/**
* get_query_name
* @return string
*/
public function get_query_name() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@

namespace tool_objectfs\local\object_manipulator\candidates;

/**
* chcker_candiates
*/
class checker_candidates extends manipulator_candidates_base {

/** @var string $queryname */
/**
* queryname
* @var string
*/
protected $queryname = 'get_check_candidates';

/**
* @inheritDoc
* get_candiates_sql
* @return string
*/
public function get_candidates_sql() {
Expand All @@ -43,7 +49,7 @@ public function get_candidates_sql() {
}

/**
* @inheritDoc
* get_candidates_sql_params
* @return array
*/
public function get_candidates_sql_params() {
Expand Down
14 changes: 10 additions & 4 deletions classes/local/object_manipulator/candidates/deleter_candidates.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@

namespace tool_objectfs\local\object_manipulator\candidates;

/**
* deleter_candidates
*/
class deleter_candidates extends manipulator_candidates_base {

/** @var string $queryname */
/**
* queryname
* @var string
*/
protected $queryname = 'get_delete_candidates';

/**
* @inheritDoc
* get_candiates_sql
* @return string
*/
public function get_candidates_sql() {
Expand All @@ -43,15 +49,15 @@ public function get_candidates_sql() {
}

/**
* @inheritDoc
* get_candiates_sql_params
* @return array
*/
public function get_candidates_sql_params() {
$consistancythreshold = time() - $this->config->consistencydelay;
return [
'consistancythreshold' => $consistancythreshold,
'location' => OBJECT_LOCATION_DUPLICATED,
'sizethreshold' => $this->config->sizethreshold
'sizethreshold' => $this->config->sizethreshold,
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function get_candidates_sql();
public function get_candidates_sql_params();

/**
* get
* @return array
* @throws dml_exception
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
use dml_exception;
use stdClass;

/**
* manipulator_candidates_base
*/
abstract class manipulator_candidates_base implements manipulator_candidates {

/** @var stdClass $config */
Expand All @@ -41,14 +44,15 @@ public function __construct(stdClass $config) {
}

/**
* @inheritDoc
* get_query_name
* @return string
*/
public function get_query_name() {
return $this->queryname;
}

/**
* get
* @return array
* @throws dml_exception
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@

namespace tool_objectfs\local\object_manipulator\candidates;

/**
* orphaner_candidates
*/
class orphaner_candidates extends manipulator_candidates_base {

/** @var string $queryname */
/**
* queryname
* @var string
*/
protected $queryname = 'get_orphan_candidates';

/**
* @inheritDoc
* get_candidates_sql
* @return string
*/
public function get_candidates_sql() {
Expand All @@ -42,12 +48,12 @@ public function get_candidates_sql() {
}

/**
* @inheritDoc
* get_candidates_sql_params
* @return array
*/
public function get_candidates_sql_params() {
return [
'location' => OBJECT_LOCATION_ORPHANED
'location' => OBJECT_LOCATION_ORPHANED,
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@

namespace tool_objectfs\local\object_manipulator\candidates;

/**
* puller_candidates
*/
class puller_candidates extends manipulator_candidates_base {

/** @var string $queryname */
/**
* queryname
* @var string
*/
protected $queryname = 'get_pull_candidates';

/**
* @inheritDoc
* get_candidates_sql
* @return string
*/
public function get_candidates_sql() {
Expand All @@ -42,7 +48,7 @@ public function get_candidates_sql() {
}

/**
* @inheritDoc
* get_candidates_sql_params
* @return array
*/
public function get_candidates_sql_params() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@

namespace tool_objectfs\local\object_manipulator\candidates;

defined('MOODLE_INTERNAL') || die();

/**
* pusher_candidates
*/
class pusher_candidates extends manipulator_candidates_base {

/** @var string $queryname */
/**
* queryname
* @var string
*/
protected $queryname = 'get_push_candidates';

/**
* @inheritDoc
* get_candidates_sql
* @return string
*/
public function get_candidates_sql() {
Expand All @@ -46,7 +50,7 @@ public function get_candidates_sql() {
}

/**
* @inheritDoc
* get_candidates_sql_params
* @return array
*/
public function get_candidates_sql_params() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@

namespace tool_objectfs\local\object_manipulator\candidates;

/**
* recoverer_candidates
*/
class recoverer_candidates extends manipulator_candidates_base {

/** @var string $queryname */
/**
* queryname
* @var string
*/
protected $queryname = 'get_recover_candidates';

/**
* @inheritDoc
* get_candidates_sql
* @return string
*/
public function get_candidates_sql() {
Expand All @@ -41,7 +47,7 @@ public function get_candidates_sql() {
}

/**
* @inheritDoc
* get_candidates_sql_params
* @return array
*/
public function get_candidates_sql_params() {
Expand Down
Loading