|
From: Kenneth T. <ken...@gm...> - 2009-04-24 03:02:06
|
It was driving me crazy to be waiting for the whole engine array to
updat every time, so I changed it. With this patch, you can now update
the whole array, or just a single object. I've tested it some, and it
seems to work, but let me know if anything is broken!
I'm assuming it's better to provide patches as attachments (since line
breaks are preserved), but at least for this one, I will try both
attaching and including in the email text. I'm not really sure what if
anything the mailing list will do with or to attachments!
Ken
--- ../chasers_gpl_snapshot1a/io.php 2008-09-26 09:40:50.000000000 -0700
+++ io.php 2009-04-23 19:46:12.000000000 -0700
@@ -2557,10 +2557,13 @@ function chasers_top_header($commands=""
global $AUID, $CG_AUTH;
// if ($database[$WHICH_DB]<>"Chasers" ||
$db_server[$WHICH_DB]<>'db.desc.org') {
if (is_test_db()) {
+ $update_list = update_engine_object_list();
$test_db_warning = div(center(bold(white(bigger(
"WARNING: Test Database
$database[$WHICH_DB]",3)) .white('('.$db_server[$WHICH_DB].')')))
. bold(pop_help("test_database","","What's all
this test stuff about?")) .
- (has_perm("super") ? oline() .
smaller(hlink('update_engine_config.php','Update Engine Array')) : "")
+ (has_perm("super") ?
+ smaller( formto('update_engine_config.php')
+ . 'Update Engine Object: ' . $update_list) : "")
,
'',' style="background-color: red; text-align:
center; width:100%; padding: 10px;" id="chasersTestWarningBox"');
$test_hide_link = Java_Engine::toggle_id_display(' +/- Test DB
Warning box','chasersTestWarningBox','block');
--- ../chasers_gpl_snapshot1a/engine_functions.php 2008-09-26
15:25:34.000000000 -0700
+++ engine_functions.php 2009-04-23 19:43:58.000000000 -0700
@@ -2689,7 +2689,6 @@ function update_engine_array($use_auth=t
global $CG_ENGINE_TABLES,$engine,$off;
$engine_array = orr($engine_array,CG_ENGINE_CONFIG_ARRAY);
- $tables = orr($tables,$CG_ENGINE_TABLES);
$engine = null; //objects w/o config files were not configuring
properly w/o this
$auth = $use_auth ? has_perm('admin','RW') : true;
@@ -2698,10 +2697,17 @@ function update_engine_array($use_auth=t
exit;
}
- outline(bold('Updating and storing in Engine Array: '.$engine_array));
+ outline(bold('Updating and storing in Engine Array:
'.$engine_array),2);
//GENERATE ENGINE ARRAY FROM CONFIG FILES
require ENGINE_CONFIG_FILE_DIRECTORY.'/config_engine.php';
-
+ if ($tables)
+ {
+ $engine=get_engine_config_array();
+ }
+ else
+ {
+ $tables=$CG_ENGINE_TABLES;
+ }
foreach ($tables as $tmp) {
if (is_readable($off . ENGINE_CONFIG_FILE_DIRECTORY .
'/'.CG_MAIN_OBJECT_DB.'/config_'.$tmp.'.php')) {
@@ -2725,6 +2731,7 @@ function update_engine_array($use_auth=t
$serialized_engine=serialize($engine);
+ outline();
outline(bold('UPDATING CONFIGURATION ARRAY IN DB'));
$exists=desc_query('SELECT * FROM
'.CG_ENGINE_CONFIG_TABLE,array('val_name'=>$engine_array));
if (sql_num_rows($exists)<1) {
@@ -3549,4 +3556,21 @@ function grab_append_only_fields($rec,$d
return $rec;
}
+function update_engine_object_list()
+{
+ /*
+ * Create a pick list for updating individual engine items
+ */
+
+ GLOBAL $CG_ENGINE_TABLES;
+
+ $update_list = selectto('UPDATE_ENGINE_OBJECT')
+ . selectitem('UPDATE_ALL','Full Engine Array');
+ foreach ($CG_ENGINE_TABLES as $table) {
+ $update_list .=
selectitem($table,$table,orr($_REQUEST['UPDATE_ENGINE_OBJECT'],
+ $_SESSION['UPDATE_ENGINE_OBJECT'])==$table);
+ }
+ $update_list .= selectend() . button('update!') . formend();
+ return $update_list;
+}
?>
--- ../chasers_gpl_snapshot1a/update_engine_config.php 2008-09-26
09:40:52.000000000 -0700
+++ update_engine_config.php 2009-04-23 19:49:23.000000000 -0700
@@ -42,10 +42,20 @@ if (isset($_REQUEST['noexists']) || (iss
$CG_FULL_INI = false;
include 'performance.php';
include 'includes.php';
-
+
+ if ($table=$_REQUEST['UPDATE_ENGINE_OBJECT'])
+ {
+ $_SESSION['UPDATE_ENGINE_OBJECT']=$table;
+ if ($table=='UPDATE_ALL')
+ {
+ $table=null;
+ } else {
+ $table=array($table);
+ }
+ }
+
//GENERATE ENGINE ARRAY FROM CONFIG FILES
-
- $res = update_engine_array();
+ $res = update_engine_array(true,NULL,$table);
if ($res) {
|