[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/repository/boxnet/ -> migrationv1.php (source)

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  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/>.
  16  
  17  /**
  18   * Box.net APIv1 migration tool.
  19   *
  20   * This tool is intended to migrate the references of the APIv1 of Box.net
  21   * as this API is going end of life in December 14th 2013. As there is no
  22   * way to support the references in the APIv2, we will convert those old
  23   * references to local files.
  24   *
  25   * This operation can take a long time depending on the number of references
  26   * used and their size.
  27   *
  28   * @package    repository_boxnet
  29   * @copyright  2013 Frédéric Massart
  30   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  31   * @todo       Deprecate/remove this tool after the 14th of December 2013.
  32   */
  33  
  34  define('NO_OUTPUT_BUFFERING', true);
  35  
  36  require_once(__DIR__ . '/../../config.php');
  37  require_once($CFG->libdir . '/adminlib.php');
  38  require_once($CFG->dirroot . '/repository/boxnet/locallib.php');
  39  
  40  require_login();
  41  require_capability('moodle/site:config', context_system::instance());
  42  
  43  $title = get_string('migrationtool', 'repository_boxnet');
  44  $PAGE->set_context(context_system::instance());
  45  $PAGE->set_pagelayout('maintenance');
  46  $PAGE->set_title($title);
  47  $PAGE->set_heading($title);
  48  $PAGE->set_url(new moodle_url('/repository/boxnet/migrationv1.php'));
  49  $PAGE->navbar->add($title);
  50  
  51  $confirm = optional_param('confirm', false, PARAM_BOOL);
  52  
  53  echo $OUTPUT->header();
  54  echo $OUTPUT->heading('Reference migration tool');
  55  
  56  if ($confirm && confirm_sesskey()) {
  57      echo html_writer::start_tag('pre', array());
  58      repository_boxnet_migrate_references_from_apiv1();
  59      echo html_writer::end_tag('pre', array());
  60  } else {
  61      $a = new stdClass();
  62      $a->docsurl = get_docs_url('Box.net_APIv1_migration');
  63      echo html_writer::tag('p', get_string('migrationinfo', 'repository_boxnet', $a));
  64      $execurl = new moodle_url('/repository/boxnet/migrationv1.php', array('confirm' => 1, 'sesskey' => sesskey()));
  65      $button = new single_button($execurl, get_string('runthemigrationnow', 'repository_boxnet'));
  66      echo $OUTPUT->render($button);
  67  }
  68  
  69  echo $OUTPUT->footer();


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1