forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-38509 Implement the plugin ZIP package validator
The validator code contains (modified) fragments of the local_plugins_archive_validator class copyrighted by Marina Glancy that is part of the local_plugins plugin. It operates over an extracted copy of the ZIP file.
- Loading branch information
Showing
26 changed files
with
1,015 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
admin/tool/installaddon/tests/fixtures/emptydir/emptydir/README.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Plugin must have more than one file. |
1 change: 1 addition & 0 deletions
1
...addon/tests/fixtures/github/moodle-repository_mahara-master/lang/en/repository_mahara.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php |
4 changes: 4 additions & 0 deletions
4
admin/tool/installaddon/tests/fixtures/github/moodle-repository_mahara-master/version.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
|
||
$plugin->component = 'repository_mahara'; | ||
$plugin->version = 2014010100; |
3 changes: 3 additions & 0 deletions
3
admin/tool/installaddon/tests/fixtures/installed/greenbar/index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
echo 'One, my little hobbit, never installs malicisous add-ons'; |
3 changes: 3 additions & 0 deletions
3
admin/tool/installaddon/tests/fixtures/installed/greenbar/lang/en/local_greenbar.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
$string['pluginname'] = 'Foo bar!'; |
4 changes: 4 additions & 0 deletions
4
admin/tool/installaddon/tests/fixtures/installed/greenbar/version.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
|
||
$plugin->version = 2013031900; | ||
$plugin->component = 'local_greenbar'; |
3 changes: 3 additions & 0 deletions
3
admin/tool/installaddon/tests/fixtures/multidir/one/version.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
$plugin->component = 'local_one'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Only one dir is allowed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php |
1 change: 1 addition & 0 deletions
1
admin/tool/installaddon/tests/fixtures/nolang/bah/lang/en/bah.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php |
3 changes: 3 additions & 0 deletions
3
admin/tool/installaddon/tests/fixtures/nolang/bah/lang/en/bleh.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
$string['pluginnname'] = 'Root directory mismatch'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
|
4 changes: 4 additions & 0 deletions
4
admin/tool/installaddon/tests/fixtures/nolang/bah/version.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
|
||
$module->version = 2014122455; | ||
$plugin->version = 2014122455; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
echo 'Do not use hardcoded strings, provide the language pack'; |
3 changes: 3 additions & 0 deletions
3
admin/tool/installaddon/tests/fixtures/noversionmod/noversion/lang/en/noversion.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
$string['pluginversion'] = 'Activity module with no version.php'; |
3 changes: 3 additions & 0 deletions
3
admin/tool/installaddon/tests/fixtures/noversiontheme/noversion/lang/en/theme_noversion.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
$string['pluginversion'] = 'A theme with no version.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
// index.php |
3 changes: 3 additions & 0 deletions
3
admin/tool/installaddon/tests/fixtures/nowrapdir/lang/en/foo.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
$string['pluginname'] = 'Foo!'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php // $Id$ | ||
|
||
// I don't miss CVS, do you? |
3 changes: 3 additions & 0 deletions
3
admin/tool/installaddon/tests/fixtures/plugindir/foobar/index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
echo 'One, my little hobbit, never installs malicisous add-ons'; |
3 changes: 3 additions & 0 deletions
3
admin/tool/installaddon/tests/fixtures/plugindir/foobar/lang/en/local_foobar.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
$string['pluginname'] = 'Foo bar!'; |
9 changes: 9 additions & 0 deletions
9
admin/tool/installaddon/tests/fixtures/plugindir/foobar/version.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
$module->version = 10; // Ignored, this should use $plugin | ||
$plugin->version = 2013031900; | ||
$plugin->component = 'local_foobar'; | ||
$plugin->requires = 2013031200; | ||
$module->release = 'We are not an activity module!'; | ||
$plugin->maturity = MATURITY_ALPHA; | ||
//$plugin->release = 'And this is commented'; |
52 changes: 52 additions & 0 deletions
52
admin/tool/installaddon/tests/fixtures/versionphp/version1.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<h1>Example version.php file</h1> | ||
|
||
<p>version.php is required for all plugins but themes.</p> | ||
|
||
<h2>Example of values</h2> | ||
|
||
<pre> | ||
$plugin->version = 2011051000; | ||
$plugin->requires = 2010112400; | ||
$plugin->cron = 0; | ||
$plugin->component = 'plugintype_pluginname'; | ||
$plugin->maturity = MATURITY_STABLE; | ||
$plugin->release = '2.x (Build: 2011051000)'; | ||
$plugin->dependencies = array('mod_forum' => ANY_VERSION, 'mod_data' => 2010020300); | ||
</pre> | ||
|
||
Replace $plugin with $module for activity modules, as in | ||
|
||
<pre> | ||
$module->version = 2012122400; | ||
</pre><?php // $Id$ $module->version = 1; | ||
|
||
$plugin->component | ||
= 'old_foobar';//$plugin->component='commented'; | ||
|
||
$plugin->component = | ||
'block_foobar'; | ||
|
||
$plugin->version = 2013010100; | ||
////////$plugin->version = 0; | ||
/* for activity | ||
modules use: | ||
$module->version = 2014131300; | ||
***/ | ||
$plugin->version = "2010091855"; // Do not use quotes here. | ||
$plugin->version = '2010091856.9'; // Do not use quotes here. | ||
|
||
|
||
$plugin->requires = /* 2012010100 */ 2012122401 ; | ||
|
||
$module->maturity = MATURITY_STABLE; | ||
$module->maturity = 50; // If both present, the constant wins (on contrary to what PHP would do) | ||
$module->maturity = 'MATURITY_BETA'; // Do not use quotes here. | ||
|
||
$plugin->maturity = 10; | ||
$plugin->maturity = MATURITY_ALPHA; | ||
|
||
|
||
|
||
$module->release = 2.3; $plugin->release = 'v2.4'; | ||
$module->release = "v2.3"; $plugin->release = 2.4; |
1 change: 1 addition & 0 deletions
1
admin/tool/installaddon/tests/fixtures/writable/local/greenbar/README.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Existing |
Oops, something went wrong.