summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-05-04 09:41:37 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-05-04 09:41:37 +0000
commitc740ac7fd58b5f4597bde987ae9263f3d05febd8 (patch)
tree0eb9221dd27cfa6d308e99babc41b1f9fd474c7b /modules
parent304400293a997a76290f04c7d1d65680fef2c7d8 (diff)
downloadbrdo-c740ac7fd58b5f4597bde987ae9263f3d05febd8.tar.gz
brdo-c740ac7fd58b5f4597bde987ae9263f3d05febd8.tar.bz2
#127539: progressive operation support, refactoring update.php code to a generic batch API to support runnning operations in multiple HTTP requests
- update.php is already on the batch API - node access rebuilding is in the works - automatic locale importing is in the works Thanks to Yves Chedemois (yched) for the good code quality, very wide awareness of issues related to batches, and the fantastic turnaround times. Hats off.
Diffstat (limited to 'modules')
-rw-r--r--modules/system/page.tpl.php2
-rw-r--r--modules/system/system.install18
-rw-r--r--modules/system/system.module23
3 files changed, 42 insertions, 1 deletions
diff --git a/modules/system/page.tpl.php b/modules/system/page.tpl.php
index fce977e5f..5bf9e423b 100644
--- a/modules/system/page.tpl.php
+++ b/modules/system/page.tpl.php
@@ -41,7 +41,7 @@
<h1 class="title"><?php print $title ?></h1>
<div class="tabs"><?php print $tabs ?></div>
<?php print $help ?>
- <?php print $messages ?>
+ <?php if ($show_messages) { print $messages; }?>
<?php print $content; ?>
<?php print $feed_icons; ?>
</div>
diff --git a/modules/system/system.install b/modules/system/system.install
index f409de7fa..7cf9b1979 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -190,6 +190,15 @@ function system_install() {
UNIQUE KEY authname (authname)
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
+ db_query("CREATE TABLE {batch} (
+ bid int(11) NOT NULL,
+ sid varchar(64) NOT NULL,
+ timestamp int(11) NOT NULL,
+ batch longtext,
+ PRIMARY KEY (bid),
+ KEY sid (sid)
+ ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
+
db_query("CREATE TABLE {blocks} (
module varchar(64) DEFAULT '' NOT NULL,
delta varchar(32) NOT NULL default '0',
@@ -666,6 +675,15 @@ function system_install() {
UNIQUE (authname)
)");
+ db_query("CREATE TABLE {batch} (
+ bid int NOT NULL default '0',
+ sid varchar(64) NOT NULL default '',
+ timestamp int NOT NULL default '0',
+ batch text,
+ PRIMARY KEY (bid),
+ )");
+ db_query("CREATE INDEX {batch}_sid_idx ON {batch} (sid)");
+
db_query("CREATE TABLE {blocks} (
module varchar(64) DEFAULT '' NOT NULL,
delta varchar(32) NOT NULL default '0',
diff --git a/modules/system/system.module b/modules/system/system.module
index fab91e2d6..a18439e07 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -327,6 +327,12 @@ function system_menu() {
'page callback' => 'system_sql',
'type' => MENU_CALLBACK,
);
+ // Default page for batch operations
+ $items['batch'] = array(
+ 'page callback' => 'system_batch_page',
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
return $items;
}
@@ -2459,5 +2465,22 @@ function theme_system_admin_by_module($menu_items) {
function system_cron() {
// Cleanup the flood
db_query('DELETE FROM {flood} WHERE timestamp < %d', time() - 3600);
+ // Cleanup the batch table
+ db_query('DELETE FROM {batch} WHERE timestamp < %d', time() - 864000);
}
+/**
+ * Default page callback for batches.
+ */
+function system_batch_page() {
+ require_once './includes/batch.inc';
+ $output = _batch_page();
+ if ($output === FALSE) {
+ drupal_access_denied();
+ }
+ else {
+ // Force a page without blocks or messages to
+ // display a list of collected messages later.
+ print theme('page', $output, FALSE, FALSE);
+ }
+}