Minor: Update scripts to make removable die() statement more explicit

pull/5461/head
Yannick Warnier 1 year ago
parent e21437d5a2
commit e9f39c4393
  1. 2
      tests/scripts/build_translation_request_file.php
  2. 6
      tests/scripts/check_extra_fields.php
  3. 4
      tests/scripts/check_users_in_csv_file.php
  4. 3
      tests/scripts/course2session.php
  5. 4
      tests/scripts/delete_deleted_exercises_with_questions.php
  6. 4
      tests/scripts/delete_items_from_csv.php
  7. 4
      tests/scripts/delete_old_courses.php
  8. 4
      tests/scripts/delete_old_courses_even_not_empty.php
  9. 2
      tests/scripts/delete_old_tasks.php
  10. 4
      tests/scripts/delete_orphan_questions.php
  11. 3
      tests/scripts/delete_users_from_csv.php
  12. 3
      tests/scripts/detect_deleted_visible_documents.php
  13. 3
      tests/scripts/disable_user_conditions.php
  14. 2
      tests/scripts/edit_course_html_files.php
  15. 2
      tests/scripts/fix_course_index.php
  16. 3
      tests/scripts/fix_course_spent_time.php
  17. 4
      tests/scripts/fix_documents_path.php
  18. 4
      tests/scripts/fix_duplicate_settings.php
  19. 4
      tests/scripts/fix_exercise_score_in_lp.php
  20. 2
      tests/scripts/fix_group_items_with_old_db.php
  21. 2
      tests/scripts/fix_lp_calendar.php
  22. 4
      tests/scripts/fix_lp_id_to_iid.php
  23. 4
      tests/scripts/fix_lp_id_to_iid_v2.php
  24. 4
      tests/scripts/fix_lp_items_not_found.php
  25. 3
      tests/scripts/fix_migrations_1.9.x_1.10.0.php
  26. 4
      tests/scripts/fix_mimetex.php
  27. 4
      tests/scripts/fix_restored_learnpaths.php
  28. 3
      tests/scripts/fix_student_publication_id.php
  29. 2
      tests/scripts/fix_user_id.php
  30. 4
      tests/scripts/insert_session_fields.php
  31. 2
      tests/scripts/insert_sessions_categories.php
  32. 2
      tests/scripts/kill_all_queries.php
  33. 4
      tests/scripts/login_as_admin.php
  34. 4
      tests/scripts/migrate_item_property.php
  35. 2
      tests/scripts/move_users.php
  36. 2
      tests/scripts/multi_url_conversion.php
  37. 4
      tests/scripts/restore_deleted_documents.php
  38. 4
      tests/scripts/settings2csv.php
  39. 2
      tests/scripts/switch_files_to_gettext.php
  40. 2
      tests/scripts/synchronize_user_base_from_ldap.php
  41. 4
      tests/scripts/update_user_extra_field.php
  42. 2
      tests/scripts/userfields_to_groups.php
  43. 3
      tests/scripts/users_no_course.php
  44. 2
      tests/scripts/video.php
  45. 2
      tests/scripts/wipe-out.php

@ -7,7 +7,7 @@
/**
* Includes and declarations
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
$path = api_get_path(SYS_LANG_PATH);
$referenceLanguage = 'english';

@ -3,12 +3,10 @@
/**
* This script checks if the default extra fields are present in the platform.
* If a default extra field doesn't exists then it will created.
* If a default extra field doesn't exist, it will be created.
* Extra field list as in 1.11.8
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
$em = Database::getManager();

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
api_protect_admin_script();

@ -7,8 +7,7 @@
/**
* Init
*/
// comment exit statement before executing
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
$debug = 1;

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
$sql = 'SELECT iid, c_id, title

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
$file = 'delete.csv';

@ -11,9 +11,7 @@
* Launch from the command line.
* Usage: php delete_old_courses.php
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
$creation = '2014-01-01';
$access = '2014-07-01';

@ -4,9 +4,7 @@
* with the LP score result (lp_item_view.score).
* This script works only if 1 there's one attempt
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
if (PHP_SAPI !== 'cli') {

@ -11,7 +11,7 @@
* @author Percy Santiago <psantiago@icpna.edu.pe>
* @author Yannick Warnier <yannick.warnier@beeznest.com>
*/
exit; //remove this line to execute from the command line
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
if (PHP_SAPI !== 'cli') {
die('This script can only be executed from the command line');
}

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
$sql = 'SELECT iid, c_id, question

@ -1,7 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
api_protect_admin_script();

@ -3,8 +3,7 @@
/**
* Detects visible _DELETED_ visible files
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
api_protect_admin_script();

@ -15,8 +15,7 @@
* if he has a generated the general certificate) and has not connected to the platfrom for more
* than 6 months then deactivate his account and send an email to the learner.
* */
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
$senderId = api_get_setting('platform.disable_user_conditions_sender_id');

@ -11,7 +11,7 @@
* need to move it to an executable folder and change the first require.
* @author Yannick Warnier <yannick.warnier@beeznest.com>
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
api_protect_admin_script();

@ -11,7 +11,7 @@
* - Check the results in one index.php file
* - Delete this file
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
if (PHP_SAPI != 'cli') {
die('This script can only be launched from the command line');
}

@ -6,8 +6,7 @@
* the records in track_e_course_access that is used to calculate the
* total course time.
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
$maxSeconds = 10 * 60 * 60; // Check records higher than X hours

@ -16,9 +16,7 @@
* exercises (question, answer) and course description in the database.
*
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
/*$test = '

@ -3,9 +3,7 @@
/**
* Remove the current_settings duplicates from migration 1.9.x to 1.10.x
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
//api_protect_admin_script();

@ -6,9 +6,7 @@
* with the LP score result (lp_item_view.score).
* This script works only if 1 there's one attempt
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
api_protect_admin_script();

@ -21,7 +21,7 @@
/**
* Context initialization
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
if (PHP_SAPI != 'cli') {
die('This script can only be executed from the command line');
}

@ -1,6 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
$extraField = new ExtraField('lp_item');

@ -4,9 +4,7 @@
/**
* This script fixes use of id instead of iid for the learning path
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
/** @var int $courseId */

@ -4,9 +4,7 @@
/**
* This script fixes use of id instead of iid for the learning path
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
/** @var int $courseId */

@ -6,9 +6,7 @@
* It's useful when the path field in c_lp_item table has a value like 'document/item_file.html'
* Then this values is updated to 'document/learning_path/LP_DIRECTORY/item_file.html
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
/** @var The course id $courseId */

@ -4,8 +4,7 @@
* Fix failed migration 1.9.x to 1.10.0
* Note: You need execute the ./fix_duplicate_settings.php to remove duplicated settings from failed migration
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
api_protect_admin_script();

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
$sql = 'SELECT iid, id, question, c_id

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
use Chamilo\CourseBundle\Entity\CLp;
use Doctrine\ORM\Query\Expr\Join;
use Chamilo\CourseBundle\Entity\CTool;

@ -1,7 +1,6 @@
<?php
exit;
/* For license terms, see /license.txt */
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
if (PHP_SAPI != 'cli') {
die('This script can only be launched from the command line');
}

@ -3,7 +3,7 @@
/**
* Temporary fix to set user.user_id to the same as user.id
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
if (PHP_SAPI != 'cli') {
die('This script can only be executed from the command line');
}

@ -2,9 +2,7 @@
/*
* This script insert session extra fields
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
api_protect_admin_script();

@ -3,7 +3,7 @@
/**
* This script generates four session categories.
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
api_protect_admin_script();

@ -9,7 +9,7 @@
* In this case, disable the exit(); line below, run this script and then you
* should be able to quickly restart your database.
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
$result = Database::query("SHOW FULL PROCESSLIST");
while ($row=Database::fetch_array($result)) {

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
if (PHP_SAPI != 'cli') {
die('This script can only be executed from the command line');
}

@ -15,11 +15,11 @@ use Chamilo\CoreBundle\Security\Authorization\Voter\ResourceNodeVoter;
* Migrate content from c_item_property and c_document tables to the new "Resource" system.
*
*/
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
echo 'First check if table "classification__category" has a default category; if not then run: <br />';
echo 'bin/console sonata:media:fix-media-context';
echo 'change course id in the query';
exit;
// For tests to clean all resource stuff:
//

@ -10,7 +10,7 @@
/**
* Init
*/
die('Remove the "die()" line to execute this script'.PHP_EOL);
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
// Define origin and destination courses' code
$originCourse = 'XYZ2014';

@ -6,7 +6,7 @@
* This means creating a new URL of ID 1 and moving all previous records
* referencing ID 1 to ID 2.
*/
die();
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
$tableAccessUrl = Database::get_main_table(TABLE_MAIN_ACCESS_URL);

@ -7,9 +7,7 @@
use Chamilo\CourseBundle\Entity\CDocument;
use Chamilo\CourseBundle\Entity\CItemProperty;
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
api_protect_admin_script();

@ -12,9 +12,7 @@
/**
* Init
*/
// comment exit statement before executing
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
/* Usage doc */
if ($argc <= 1) {
echo 'Usage: php settings2csv.php [language]'.PHP_EOL;

@ -6,7 +6,7 @@
/**
* Includes and declarations.
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
$path = api_get_path(SYS_LANG_PATH).'english';
ini_set('memory_limit', '128M');

@ -23,7 +23,7 @@ defined in app/config/auth.conf.php or overriden in app/config/configuration.php
username field is used to identify and match LDAP and Chamilo accounts together.
($extldap_user_correspondance['username'])
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
// Change this to the absolute path to chamilo root folder if you move the script out of tests/scripts
$chamiloRoot = __DIR__.'/../../public';

@ -14,9 +14,7 @@
* "julio" is the username of the user to be updated
*
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
// Define origin and destination courses' code

@ -3,7 +3,7 @@
* Move user fields "ruc" and "razon_social" to (social) groups (create groups)
* and assign the related users to those groups.
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
if (PHP_SAPI != 'cli') {
die('This script can only be launched from the command line');
}

@ -5,8 +5,7 @@
* This script select all users with no course subscriptions and
* add it to a selected course.
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
require_once __DIR__.'/../../public/main/inc/global.inc.php';
api_protect_admin_script();

@ -7,7 +7,7 @@
* @todo Add security filtering for filenames
* @author Yannick Warnier <yannick.warnier@beeznest.com>
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
ini_set('memory_limit',0);
ini_set('max_execution_time',0);
ini_set('upload_max_filesize',0);

@ -14,7 +14,7 @@
/**
* Security checks
*/
exit;
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
if (PHP_SAPI != 'cli') {
echo "For security reasons, this script can only be launched from the command line, sorry.";
exit;

Loading…
Cancel
Save