Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-local_archive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
uw-moodle
moodle-local_archive
Commits
3cb82487
Commit
3cb82487
authored
12 years ago
by
Matt Petro
Browse files
Options
Downloads
Patches
Plain Diff
cli update script accepts a list of archives to update
parent
42490d00
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cli/update_index.php
+11
-5
11 additions, 5 deletions
cli/update_index.php
lib.php
+6
-1
6 additions, 1 deletion
lib.php
with
17 additions
and
6 deletions
cli/update_index.php
+
11
−
5
View file @
3cb82487
...
@@ -2,28 +2,34 @@
...
@@ -2,28 +2,34 @@
/**
/**
* CLI script to update archive index
* CLI script to update archive index
*
* Usage: php update_index.php [name1] [name2] [...]
*/
*/
define
(
'CLI_SCRIPT'
,
true
);
define
(
'CLI_SCRIPT'
,
true
);
/*
/*
*
* Configuration is in moodle's config.php
* Configuration is in moodle's config.php
*
*
* Sample:
* Sample:
*
*
* $CFG->local_archive_config[] =
* $CFG->local_archive_config[] =
* array('type'=>'backup1
9
' // storage type (backup1
9
= moodle 1.
9
backup)
* array('type'=>'backup1' // storage type (backup1 = moodle 1.
x
backup)
* 'name'=>'ecow2', // unique name
* 'name'=>'ecow2', // unique name
* 'directory'=>'/backups' // directory containing backups
* 'directory'=>'/backups' // directory containing backups
* );
* );
*
*
*/
*/
require_once
(
dirname
(
dirname
(
dirname
(
dirname
(
__FILE__
))))
.
'/config.php'
);
require_once
(
dirname
(
dirname
(
dirname
(
dirname
(
__FILE__
))))
.
'/config.php'
);
require_once
(
$CFG
->
dirroot
.
'/local/archive/lib.php'
);
require_once
(
$CFG
->
dirroot
.
'/local/archive/lib.php'
);
//
// Ensure errors are well explained
// Ensure errors are well explained
$CFG
->
debug
=
DEBUG_NORMAL
;
$CFG
->
debug
=
DEBUG_NORMAL
;
local_archive_update_index
();
$instances
=
array_slice
(
$argv
,
1
);
local_archive_update_index
(
$instances
);
This diff is collapsed.
Click to expand it.
lib.php
+
6
−
1
View file @
3cb82487
...
@@ -38,11 +38,16 @@ function local_archive_get_storageclass($config) {
...
@@ -38,11 +38,16 @@ function local_archive_get_storageclass($config) {
return
new
$classname
(
$config
);
return
new
$classname
(
$config
);
}
}
function
local_archive_update_index
()
{
function
local_archive_update_index
(
$instancenames
=
array
()
)
{
global
$CFG
,
$LOCAL_ARCHIVE_INSTANCES
;
global
$CFG
,
$LOCAL_ARCHIVE_INSTANCES
;
global
$DB
;
global
$DB
;
local_archive_init_archives
();
local_archive_init_archives
();
foreach
(
$LOCAL_ARCHIVE_INSTANCES
as
$archive
)
{
foreach
(
$LOCAL_ARCHIVE_INSTANCES
as
$archive
)
{
if
(
!
empty
(
$instancenames
))
{
if
(
false
===
array_search
(
$archive
->
get_name
(),
$instancenames
))
{
continue
;
// skip this archive
}
}
mtrace
(
"Updating "
.
$archive
->
get_name
()
.
" ("
.
$archive
->
get_storagetype
()
.
")... "
);
mtrace
(
"Updating "
.
$archive
->
get_name
()
.
" ("
.
$archive
->
get_storagetype
()
.
")... "
);
try
{
try
{
$archive
->
update_index
();
$archive
->
update_index
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment