• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 223 posts ]  Go to page Previous  1 ... 11, 12, 13, 14, 15
Author Message
 Post subject: Re: 1.0 Beta6 Released!
PostPosted: Sat Sep 09, 2006 11:15 pm 
Offline
Administrator
Administrator
User avatar

Joined: Fri Jun 11, 2004 6:58 pm
Posts: 3332
Location: Fairless Hills, Pa USA
I wish I could remember why I did this...  If I remember, it was the same kind of thing that 1.30 is giving me.  Something in the adodb lite core was relying on a piece that was in the transaction module.  I think it was the same kind of thing...  they're not testing properly without all of the modules turned off.

And I agree, we shouldn't need transaction code.  We're not using it anywhere.... though maybe we should.  ;)

Piratos wrote:
I found this in your code:

Quote:
$dbinstance = &ADONewConnection($config['dbms'], 'pear:date:extend:transaction');


But to use it the tables must bei InnoDB and not Myisam and this only a few providers have enabled it.

And here the text of the Adodb Lite Handbook

Quote:
Transaction functions for the mssql, mssqlpo, mysqli, mysqlt, odbc, postgres, postgres64, postgres7, postgres8, sqlite, sqlitepo, sybase and sybase_ase Drivers. The Transaction Module will add 10-12k to the libraries memory overhead.


Mysql is not supported  AND you have no need for transactions because never in use.

_________________
http://about.me/tedkulp


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: 1.0 Beta6 Released!
PostPosted: Sun Sep 10, 2006 4:12 am 
Ted wrote:
Change the url from https to http.  Not sure why you have that, but as soon as I took it off, it came right up.


that did it.

Not sure why it added the s either.  It did it on it's own though, I didn't add it.

badger


Top
   
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Too many code for nothing
PostPosted: Sun Sep 10, 2006 9:05 am 
Some little things:


        if (ini_get("safe_mode") != "1")
$this->use_sub_dirs = true;
//$this->caching = false;  this is smarty default
//$this->compile_check = true; this is smarty default
$this->assign('app_name','CMS');
//$this->debugging = false;  this is smarty default
//$this->force_compile = false;  this is smarty default
$this->cache_plugins = false;

if ($config["debug"] == true)
{
//$this->caching = false; this is smarty default
$this->force_compile = true;
$this->debugging = true;
}


i find this  echo $sql_queries;  here ( and in several scripts)

should be  $db->query_count


Top
   
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: 1.0 Beta6 Released!
PostPosted: Sun Sep 10, 2006 9:18 am 
found in class.contentoperations.inc.php

$query = "SELECT * FROM ".cms_db_prefix()."content WHERE content_id = ?";
if ($only_active == true)
{
$query .= " AND active = 1";
}
$row = &$db->GetRow($query, array($alias,$alias));

should be $row = &$db->GetRow($query, array($alias));


Top
   
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: stylesheets.php and plugin stylesheet
PostPosted: Sun Sep 10, 2006 10:49 am 
with the standard installation you call the page home and 3 times the big stylesheet.php and the plugin stylesheet is calling teh db one more time.

This is the speed version of plugin stylesheet - it does not need the stylesheet.php and only one db calling:

Code:
function smarty_cms_function_stylesheet($params, &$smarty)
{
   global $gCms;
   $config = &$gCms->config;
   $pageinfo = &$gCms->variables['pageinfo'];
        $db =& $gCms->GetDb();
   $stylesheet = '';
             $cssquery = "SELECT DISTINCT media_type, css_text FROM ".cms_db_prefix()."css c, ".cms_db_prefix()."css_assoc
         WHERE   css_id      = assoc_css_id
         AND      assoc_type   = 'template'
         AND      assoc_to_id = ?";

                $sheets = $db->GetArray($cssquery,array($pageinfo->template_id));
                if (count($sheets)>0)
                  foreach ($sheets as $sheet)
                  {$stylesheet .='<style type="text/css" media="'.$sheet['media_type'].'">'."\n".'<!--'."\n";
                    $stylesheet .=$sheet['css_text'];
                    $stylesheet .="\n".'-->'."\n".'</style>'."\n";
                  }
   return $stylesheet;
}


This give the cms speed !


Top
   
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: 1.0 Beta6 Released!
PostPosted: Sun Sep 10, 2006 1:25 pm 
Offline
Administrator
Administrator
User avatar

Joined: Fri Jun 11, 2004 6:58 pm
Posts: 3332
Location: Fairless Hills, Pa USA
All fixed.  Though $sql_queries stuff isn't even used anymore, so I just took it out.
Piratos wrote:
Some little things:


        if (ini_get("safe_mode") != "1")
$this->use_sub_dirs = true;
//$this->caching = false;  this is smarty default
//$this->compile_check = true; this is smarty default
$this->assign('app_name','CMS');
//$this->debugging = false;  this is smarty default
//$this->force_compile = false;  this is smarty default
$this->cache_plugins = false;

if ($config["debug"] == true)
{
//$this->caching = false; this is smarty default
$this->force_compile = true;
$this->debugging = true;
}


i find this  echo $sql_queries;  here ( and in several scripts)

should be  $db->query_count


_________________
http://about.me/tedkulp


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: 1.0 Beta6 Released!
PostPosted: Sun Sep 10, 2006 1:26 pm 
Offline
Administrator
Administrator
User avatar

Joined: Fri Jun 11, 2004 6:58 pm
Posts: 3332
Location: Fairless Hills, Pa USA
Fixed

Piratos wrote:
found in class.contentoperations.inc.php

$query = "SELECT * FROM ".cms_db_prefix()."content WHERE content_id = ?";
if ($only_active == true)
{
$query .= " AND active = 1";
}
$row = &$db->GetRow($query, array($alias,$alias));

should be $row = &$db->GetRow($query, array($alias));

_________________
http://about.me/tedkulp


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: 1.0 Beta6 Released!
PostPosted: Sun Sep 10, 2006 3:24 pm 
Find in listcontent.php

        $query = "SELECT item_order FROM ".cms_db_prefix()."content WHERE content_id = ?";
$result = $db->Execute($query, array($contentid));
$row = $result->FetchRow();
if (isset($row["item_order"]))

You are not checking whether there is a result or not

The code should changed to this

$query = "SELECT item_order FROM ".cms_db_prefix()."content WHERE content_id = ?";
$row = $db->GetRow($query, array($contentid));
if (isset($row["item_order"]))

and the best is
$row = $db->GetRow("SELECT item_order FROM ".cms_db_prefix()."content WHERE content_id = ".$contentid);
if (isset($row["item_order"]))


Top
   
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: 1.0 Beta6 Released!
PostPosted: Sun Sep 10, 2006 3:39 pm 
found in listmodules.php

this
                /*
$query = "SELECT * from ".cms_db_prefix()."modules";
$result = $db->Execute($query);
while ($result && $row = $result->FetchRow()) {
$dbm[$row['module_name']]['Status'] = $row['status'];
$dbm[$row['module_name']]['Version'] = $row['version'];
$dbm[$row['module_name']]['Active'] = ($row['active'] == 1?true:false);
}
*/
should be changed to this  because faster, less memory and the resultset was closed by GetArray

$result = $db->GetArray("SELECT * from ".cms_db_prefix()."modules");
if ($result !=false)
{  foreach ($result  as $row )
                  {
$dbm[$row['module_name']]['Status'] = $row['status'];
$dbm[$row['module_name']]['Version'] = $row['version'];
$dbm[$row['module_name']]['Active'] = ($row['active'] == 1?true:false);
                  }
}


Top
   
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: 1.0 Beta6 Released!
PostPosted: Sun Sep 10, 2006 3:45 pm 
The same in sitepref.php

This
/*
$query = "SELECT * FROM ".cms_db_prefix()."templates ORDER BY template_name";
$result = $db->Execute($query);

while ($result && $row = $result->FetchRow())
{
$templates[$row['template_id']] = $row['template_name'];
}
*/

to this

$result = $db->GetArray("SELECT * FROM ".cms_db_prefix()."templates ORDER BY template_name");
if ($result != false) foreach ($result as $row) $templates[$row['template_id']] = $row['template_name'];


Top
   
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: 1.0 Beta6 Released!
PostPosted: Sun Sep 10, 2006 4:15 pm 
found in misc.functions.php

function cms_mapi_create_permission($cms, $permission_name, $permission_text)
{
global $gCms;
$db = &$gCms->GetDb();
$query = "SELECT permission_id FROM ".cms_db_prefix()."permissions WHERE permission_name =" . $db->qstr($permission_name);
$result = $db->Execute($query);

if ($result && $result->RecordCount() < 1) {

$new_id = $db->GenID(cms_db_prefix()."permissions_seq");
$query = "INSERT INTO ".cms_db_prefix()."permissions (permission_id, permission_name, permission_text, create_date, modified_date) VALUES ($new_id, ".$db->qstr($permission_name).",".$db->qstr($permission_text).",".$db->DBTimeStamp(time()).",".$db->DBTimeStamp(time()).")";
$db->Execute($query);
}

if ($result) $result->Close();

}

should changed to this because
GetOne automatically closing the resultset
inputar automatically using  qstr if the value has the type string.
less code, less memory and a little bit more speed

function cms_mapi_create_permission($cms, $permission_name, $permission_text)
{
global $gCms;
$db = &$gCms->GetDb();
$result = $db->GetOne("SELECT permission_id FROM ".cms_db_prefix()."permissions WHERE permission_name = ?",array($permission_name));
if ($result == false)
{
          $new_id = $db->GenID(cms_db_prefix()."permissions_seq");
  $query = "INSERT INTO ".cms_db_prefix()."permissions (permission_id, permission_name, permission_text, create_date, modified_date) VALUES ( ?,?,?,?,?)";
  $db->Execute($query,array(new_id,$permission_name,$permission_text,$db->DBTimeStamp(time()),$db->DBTimeStamp(time())));
        }
}

the function cms_mapi_create_permission exists  twice see module.function.php


Last edited by Piratos on Sun Sep 10, 2006 5:26 pm, edited 1 time in total.

Top
   
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: 1.0 Beta6 Released!
PostPosted: Sun Sep 10, 2006 5:34 pm 
in page.functions.php

change it to this

function load_all_permissions($userid)
{
global $gCms;
$db = &$gCms->GetDb();
$variables = &$gCms->variables;
$perms = array();
$query = "SELECT DISTINCT permission_name FROM ".cms_db_prefix()."user_groups ug INNER JOIN ".cms_db_prefix()."group_perms gp ON gp.group_id = ug.group_id INNER JOIN ".cms_db_prefix()."permissions p ON p.permission_id = gp.permission_id WHERE ug.user_id = ?";
        $result = &$db->GetArray($query, array($userid));
        if ($result) foreach($result as $row)$perms[] =$row['permission_name'];
$variables['userperms'] = $perms;
}





and this

function check_ownership($userid, $contentid = '')
{
$check = false;
global $gCms;

if (!isset($gCms->variables['ownerpages']))
{
$db =& $gCms->GetDb();

$variables = &$gCms->variables;
$variables['ownerpages'] = array();

$query = "SELECT content_id FROM ".cms_db_prefix()."content WHERE owner_id = ?";
$result = &$db->GetArray($query, array($userid));
if ($result) foreach ($result as $row)$variables['ownerpages'][] =$row['content_id'];
}

if (isset($gCms->variables['ownerpages']))
  if (in_array($contentid, $gCms->variables['ownerpages'])) $check = true;

return $check;
}

and this

function check_authorship($userid, $contentid = '')
{
$check = false;
global $gCms;

if (!isset($gCms->variables['authorpages']))
{
$db =& $gCms->GetDb();

$variables = &$gCms->variables;
$variables['authorpages'] = array();

$query = "SELECT content_id FROM ".cms_db_prefix()."additional_users WHERE user_id = ?";
$result = &$db->GetArray($query, array($userid));
if ($result) foreach ($result as $row) $variables['authorpages'][] = $row['content_id'];
}

if (isset($gCms->variables['authorpages']))
        if (in_array($contentid, $gCms->variables['authorpages']))$check = true;

return $check;
}


and this

function author_pages($userid)
{
global $gCms;
$db =& $gCms->GetDb();
    $variables = &$gCms->variables;
if (!isset($variables['authorpages']))
{
$db = &$gCms->GetDb();
$variables['authorpages'] = array();

$query = "SELECT content_id FROM ".cms_db_prefix()."content WHERE owner_id = " . $userid;
$result =& $db->GetArray($query);
if ($result) foreach ($result as $row)$variables['authorpages'][] = $row['content_id'];
$query = "SELECT content_id FROM ".cms_db_prefix()."additional_users WHERE user_id = ?";
$result = &$db->GetArray($query, array($userid));
                if ($result) foreach ($result as $row)$variables['authorpages'][] = $row['content_id'];
}

return $variables['authorpages'];
}

and this

function load_site_preferences()
{
$value = "";

global $gCms;
$db = &$gCms->GetDb();
$siteprefs = &$gCms->siteprefs;
if ($db)
{
$query = "SELECT sitepref_name, sitepref_value from ".cms_db_prefix()."siteprefs";
$result = &$db->GetArray($query);
if($result) foreach ($result as $row) $siteprefs[$row['sitepref_name']] = $row['sitepref_value'];
}

return $value;
}


and this


function set_preference($userid, $prefname, $value)
{
global $gCms;
$db =& $gCms->GetDb();

$userprefs = &$gCms->userprefs;
$userprefs[$prefname] = $value;

$query = "SELECT value from ".cms_db_prefix()."userprefs WHERE user_id = ? AND preference = ?";
$result = $db->GetOne($query, array($userid, $prefname));
        if ($result) $doinsert = false; else $doinsert=true;
if ($doinsert)
{
$query = "INSERT INTO ".cms_db_prefix()."userprefs (user_id, preference, value) VALUES (?,?,?)";
$db->Execute($query, array($userid, $prefname, $value));
}
else
{
$query = "UPDATE ".cms_db_prefix()."userprefs SET value = ? WHERE user_id = ? AND preference = ?";
$db->Execute($query, array($value, $userid, $prefname));
}
}


Last edited by Piratos on Sun Sep 10, 2006 6:20 pm, edited 1 time in total.

Top
   
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: 1.0 Beta6 Released!
PostPosted: Sun Sep 10, 2006 6:17 pm 
Error in editprefs.php

This

:



/>



must be

:



/>



Top
   
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 223 posts ]  Go to page Previous  1 ... 11, 12, 13, 14, 15

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Hosting Nation - Managed CMSMS Hosting