Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 12... Línea 12...
12
// GNU General Public License for more details.
12
// GNU General Public License for more details.
13
//
13
//
14
// You should have received a copy of the GNU General Public License
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea 16... Línea -...
16
 
-
 
17
/**
-
 
18
 * Provides core\update\code_manager class.
-
 
19
 *
-
 
20
 * @package     core_plugin
-
 
21
 * @copyright   2012, 2013, 2015 David Mudrak <david@moodle.com>
-
 
22
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-
 
23
 */
-
 
24
 
16
 
Línea -... Línea 17...
-
 
17
namespace core\update;
25
namespace core\update;
18
 
26
 
19
use core_collator;
27
use core_component;
20
use core_component;
28
use coding_exception;
21
use coding_exception;
29
use moodle_exception;
22
use moodle_exception;
Línea 42... Línea 35...
42
 * - fetch and cache ZIP files distributed via the Moodle Plugins directory
35
 * - fetch and cache ZIP files distributed via the Moodle Plugins directory
43
 * - unpack the ZIP files in a temporary storage
36
 * - unpack the ZIP files in a temporary storage
44
 * - archive existing version of the plugin source code
37
 * - archive existing version of the plugin source code
45
 * - move (deploy) the plugin source code into the $CFG->dirroot
38
 * - move (deploy) the plugin source code into the $CFG->dirroot
46
 *
39
 *
-
 
40
 * @package   core
47
 * @copyright 2015 David Mudrak <david@moodle.com>
41
 * @copyright 2012 David Mudrak <david@moodle.com>
48
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
42
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
49
 */
43
 */
50
class code_manager {
44
class code_manager {
Línea 51... Línea 45...
51
 
45
 
Línea 537... Línea 531...
537
     * @param array $files list of extracted files
531
     * @param array $files list of extracted files
538
     */
532
     */
539
    protected function move_extracted_plugin_files($sourcedir, $targetdir, array $files) {
533
    protected function move_extracted_plugin_files($sourcedir, $targetdir, array $files) {
540
        global $CFG;
534
        global $CFG;
Línea -... Línea 535...
-
 
535
 
-
 
536
        // Iterate sorted file list (to ensure directories precede files within them).
541
 
537
        core_collator::ksort($files);
542
        foreach ($files as $file => $status) {
538
        foreach ($files as $file => $status) {
543
            if ($status !== true) {
539
            if ($status !== true) {
544
                throw new moodle_exception('corrupted_archive_structure', 'core_plugin', '', $file, $status);
540
                throw new moodle_exception('corrupted_archive_structure', 'core_plugin', '', $file, $status);
Línea 545... Línea 541...
545
            }
541
            }
546
 
542
 
Línea 547... Línea 543...
547
            $source = $sourcedir.'/'.$file;
543
            $source = $sourcedir.'/'.$file;
548
            $target = $targetdir.'/'.$file;
544
            $target = $targetdir.'/'.$file;
549
 
-
 
550
            if (is_dir($source)) {
545
 
551
                continue;
-
 
552
 
-
 
553
            } else {
-
 
554
                if (!is_dir(dirname($target))) {
546
            if (is_dir($source)) {
555
                    mkdir(dirname($target), $CFG->directorypermissions, true);
547
                mkdir($target, $CFG->directorypermissions, true);
556
                }
548
            } else {
557
                rename($source, $target);
549
                rename($source, $target);
558
            }
550
            }