adding_custom_php_to_drupal_chron_directory
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
adding_custom_php_to_drupal_chron_directory [2017/08/18 08:57] – tomgle | adding_custom_php_to_drupal_chron_directory [2017/08/18 09:09] (current) – tomgle | ||
---|---|---|---|
Line 2: | Line 2: | ||
- | 10 | + | From Stackoverflow: |
- | down vote | + | |
If you need to run code just once, you can do it without installing any module, including the Devel module. | If you need to run code just once, you can do it without installing any module, including the Devel module. | ||
Write a PHP file (e.g. tasks.php), put it where the cron.php file that comes with Drupal is, and add the following code. | Write a PHP file (e.g. tasks.php), put it where the cron.php file that comes with Drupal is, and add the following code. | ||
+ | < | ||
/** | /** | ||
* Root directory of Drupal installation. | * Root directory of Drupal installation. | ||
*/ | */ | ||
define(' | define(' | ||
+ | | ||
include_once DRUPAL_ROOT . '/ | include_once DRUPAL_ROOT . '/ | ||
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); | drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); | ||
drupal_set_time_limit(240); | drupal_set_time_limit(240); | ||
- | // Your code here. | ||
| | ||
+ | // Your code here. | ||
+ | </ | ||
+ | |||
If you are already using Drush for maintaining/ | If you are already using Drush for maintaining/ | ||
< | < |
adding_custom_php_to_drupal_chron_directory.1503061071.txt.gz · Last modified: 2017/08/18 08:57 by tomgle