Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1043756
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jun 24, 12:32 PM
Size
3 KB
Mime Type
text/x-diff
Expires
Thu, Jun 26, 12:32 PM (3 h, 47 m)
Engine
blob
Format
Raw Data
Handle
675212
Attached To
rINP In-Portal
in-portal
View Options
Index: tags/RC_mar08_2/admin/orderids_import.php
===================================================================
--- tags/RC_mar08_2/admin/orderids_import.php (revision 9313)
+++ tags/RC_mar08_2/admin/orderids_import.php (revision 9314)
@@ -1,117 +1,117 @@
<?php
-
+exit;
$start = getmicrotime();
define('ADMIN', 1);
define('FULL_PATH', realpath(dirname(__FILE__).'/..') );
if (!file_exists(FULL_PATH.'/core/kernel/application.php')) {
die('Please re-checkout _inportal_kernel4 cvs module into the root directory ('.FULL_PATH.') and remove kernel/kernel4 folder. Make sure to checkout correct branch (RC or HEAD).');
}
include_once(FULL_PATH.'/core/kernel/startup.php');
/*
kApplication $application
*/
$application =& kApplication::Instance();
$application->Init();
if ($_SERVER['REMOTE_ADDR'] != '213.180.111.232')
{
exit;
}
$sql = 'UPDATE '.TABLE_PREFIX.'Orders SET OrderId = -ABS(OrderId)';
$application->Conn->Query($sql);
$sql = 'UPDATE '.TABLE_PREFIX.'OrderItems SET OrderId = -ABS(OrderId)';
$application->Conn->Query($sql);
$sql = 'SELECT co.orderid, date, o.OrderId AS wrong_id
FROM cybercomm_orders co
LEFT JOIN '.TABLE_PREFIX.'Orders o
ON co.date = o.OrderDate
';
$a_orderids = $application->Conn->Query($sql, 'date');
foreach ($a_orderids AS $date => $a_ids)
{
if ($a_ids['wrong_id'] == 0)
{
continue;
}
-
- $sql = 'UPDATE '.TABLE_PREFIX.'Orders
- SET OrderId = '.$a_ids['orderid'].'
+
+ $sql = 'UPDATE '.TABLE_PREFIX.'Orders
+ SET OrderId = '.$a_ids['orderid'].'
WHERE OrderId = '.$a_ids['wrong_id'];
$application->Conn->Query($sql);
-
- $sql = 'UPDATE '.TABLE_PREFIX.'OrderItems
- SET OrderId = '.$a_ids['orderid'].'
+
+ $sql = 'UPDATE '.TABLE_PREFIX.'OrderItems
+ SET OrderId = '.$a_ids['orderid'].'
WHERE OrderId = '.$a_ids['wrong_id'];
$application->Conn->Query($sql);
-
+
echo 'ID changed from '.$a_ids['wrong_id'].' TO '.$a_ids['orderid'].'<br>';
}
// new orders
-$sql = 'SELECT OrderId
+$sql = 'SELECT OrderId
FROM '.TABLE_PREFIX.'Orders
WHERE OrderId < 0
';
$a_neworders = $application->Conn->GetCol($sql);
// Max ID
$sql = 'SELECT MAX(OrderId) FROM '.TABLE_PREFIX.'Orders';
$max_id = $application->Conn->GetOne($sql);
foreach ($a_neworders AS $order_id)
{
$max_id++;
-
- $sql = 'UPDATE '.TABLE_PREFIX.'Orders
- SET OrderId = '.$max_id.'
+
+ $sql = 'UPDATE '.TABLE_PREFIX.'Orders
+ SET OrderId = '.$max_id.'
WHERE OrderId = '.$order_id;
$application->Conn->Query($sql);
-
- $sql = 'UPDATE '.TABLE_PREFIX.'OrderItems
- SET OrderId = '.$max_id.'
+
+ $sql = 'UPDATE '.TABLE_PREFIX.'OrderItems
+ SET OrderId = '.$max_id.'
WHERE OrderId = '.$order_id;
$application->Conn->Query($sql);
-
+
echo 'New order ID changed from '.$order_id.' TO '.$max_id.'<br>';
-
+
}
//$application->Run();
$application->Done();
$end = getmicrotime();
function getmicrotime()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
//update_memory_check_script();
function update_memory_check_script() {
$files = get_included_files();
$script = '$files = Array('."\n";
foreach ($files as $file_name) {
$script .= "\t\t'".str_replace(FULL_PATH, '', $file_name)."',\n";
}
$script .= ");\n";
echo "<pre>";
echo $script;
echo "</pre>";
}
?>
\ No newline at end of file
Property changes on: tags/RC_mar08_2/admin/orderids_import.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1.2.1
\ No newline at end of property
+1.1.2.2
\ No newline at end of property
Event Timeline
Log In to Comment