Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1068919
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
Sat, Jul 19, 4:38 AM
Size
2 KB
Mime Type
text/x-diff
Expires
Mon, Jul 21, 4:38 AM (20 h, 43 m)
Engine
blob
Format
Raw Data
Handle
691915
Attached To
rINP In-Portal
in-portal
View Options
Index: branches/unlabeled/unlabeled-1.1.2/category_update.php
===================================================================
--- branches/unlabeled/unlabeled-1.1.2/category_update.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.1.2/category_update.php (revision 4123)
@@ -0,0 +1,67 @@
+<?php
+
+$start = getmicrotime();
+
+define('FULL_PATH', realpath(dirname(__FILE__)));
+define('APPLICATION_CLASS', 'MyApplication');
+include_once(FULL_PATH.'/kernel/kernel4/startup.php');
+
+$application =& kApplication::Instance();
+$application->Init();
+
+$conn =& $application->GetADODBConnection();
+
+$sql = 'SELECT CategoryId, ResourceId FROM '.$application->getUnitOption('c', 'TableName');
+$cat_ids = $conn->Query($sql);
+if($cat_ids)
+{
+ $product_list =& $application->recallObject('p', 'p_List', Array('autoload' => false, 'per_page' => 1));
+ foreach($cat_ids as $category_data)
+ {
+ $application->SetVar('m_cat_id', $category_data['CategoryId']);
+ $application->SetVar('c_id', $category_data['CategoryId']);
+ $product_list->addFilter('category_filter', TABLE_PREFIX.'CategoryItems.CategoryId = '.$category_data['CategoryId'] );
+ $product_list->Query(true);
+ $product_list->GoFirst();
+
+ $image = $product_list->GetDBField('LocalPath');
+ if($image)
+ {
+ $sql = 'SELECT ImageId
+ FROM '.$application->getUnitOption('catimg', 'TableName').'
+ WHERE ResourceId = '.$category_data['ResourceId'].'
+ AND DefaultImg = 1';
+ $image_id = $conn->GetOne($sql);
+ if($image_id)
+ {
+ $sql = 'UPDATE '.$application->getUnitOption('catimg', 'TableName').'
+ SET LocalImage = '.$conn->qstr($image).'
+ WHERE ImageId = '.$image_id;
+ }
+ else
+ {
+ $sql = 'INSERT INTO '.$application->getUnitOption('catimg', 'TableName').'
+ VALUES (\'\', '.$category_data['ResourceId'].', \'\', \'Main\', \'Main\', 1, 1, '.$conn->qstr($image).', 1, 1, \'\', 0, '.$conn->qstr($image).', 1, 0)';
+ }
+
+ $conn->ChangeQuery($sql);
+ }
+ }
+}
+
+$end = getmicrotime();
+
+if ( $application->isDebugMode() )
+{
+ echo '<br><br><div style="font-family: arial,verdana; font-size: 8pt;">Memory used: '.round(memory_get_usage()/1024/1024, 1).' Mb <br>';
+ echo 'Time used: '.round(($end - $start), 5).' Sec <br></div>';
+}
+
+//print_pre(get_included_files());
+
+function getmicrotime()
+{
+ list($usec, $sec) = explode(" ", microtime());
+ return ((float)$usec + (float)$sec);
+}
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.1.2/category_update.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1.2.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Event Timeline
Log In to Comment