added support for reading from replicated databases
This commit is contained in:
parent
c39e7dc7b0
commit
7648c6c13f
24 changed files with 87 additions and 48 deletions
|
|
@ -19,7 +19,7 @@ use WebGUI::Session;
|
|||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my @param = WebGUI::Macro::getParams($_[0]);
|
||||
my ($groupId) = WebGUI::SQL->quickArray("select groupId from groups where groupName=".quote($param[0]));
|
||||
my ($groupId) = WebGUI::SQL->quickArray("select groupId from groups where groupName=".quote($param[0]),WebGUI::SQL->getSlave);
|
||||
$groupId = 3 if ($groupId eq "");
|
||||
if (WebGUI::Grouping::isInGroup($groupId)) {
|
||||
return $param[1];
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ sub process {
|
|||
if ($session{setting}{defaultPage} == $session{page}{pageId}) {
|
||||
$temp = $session{page}{urlizedTitle};
|
||||
} else {
|
||||
($temp) = WebGUI::SQL->quickArray("select urlizedTitle from page where pageId=$session{setting}{defaultPage}");
|
||||
($temp) = WebGUI::SQL->quickArray("select urlizedTitle from page where pageId=$session{setting}{defaultPage}",WebGUI::SQL->getSlave);
|
||||
}
|
||||
$temp = WebGUI::URL::gateway($temp);
|
||||
if ($param[0] ne "linkonly") {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ sub process {
|
|||
$format = '%z' if ($format eq "");
|
||||
$output = "";
|
||||
|
||||
($time) = WebGUI::SQL->quickArray("SELECT max(lastEdited) FROM wobject where pageId=$session{page}{pageId}");
|
||||
($time) = WebGUI::SQL->quickArray("SELECT max(lastEdited) FROM wobject where pageId=$session{page}{pageId}",WebGUI::SQL->getSlave);
|
||||
if ($time) {
|
||||
$output = $label.epochToHuman($time,$format);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ sub process {
|
|||
my $collateralFolderId = 0;
|
||||
if ($param[0] ne "") {
|
||||
($collateralFolderId) = WebGUI::SQL->quickArray("select collateralFolderId from collateralFolder
|
||||
where name=".quote($param[0]));
|
||||
where name=".quote($param[0]),WebGUI::SQL->getSlave);
|
||||
$collateralFolderId = 0 unless ($collateralFolderId);
|
||||
}
|
||||
my @images = WebGUI::SQL->buildArray("select collateralId from collateral
|
||||
where collateralType='image' and collateralFolderId=".$collateralFolderId);
|
||||
where collateralType='image' and collateralFolderId=".$collateralFolderId,WebGUI::SQL->getSlave);
|
||||
if (my $collateral = WebGUI::Collateral->new($images[rand($#images+1)])) {
|
||||
return '<img src="'.$collateral->getURL.'" '.$collateral->get("parameters").' />';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ sub process {
|
|||
my $collateralFolderId = 0;
|
||||
if ($param[0] ne "") {
|
||||
($collateralFolderId) = WebGUI::SQL->quickArray("select collateralFolderId from collateralFolder
|
||||
where name=".quote($param[0]));
|
||||
where name=".quote($param[0]),WebGUI::SQL->getSlave);
|
||||
$collateralFolderId = 0 unless ($collateralFolderId);
|
||||
}
|
||||
my @snippets = WebGUI::SQL->buildArray("select collateralId from collateral
|
||||
where collateralType='snippet' and collateralFolderId=".$collateralFolderId);
|
||||
where collateralType='snippet' and collateralFolderId=".$collateralFolderId,WebGUI::SQL->getSlave);
|
||||
if (my $collateral = WebGUI::Collateral->new($snippets[rand($#snippets+1)])) {
|
||||
return $collateral->get("parameters");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use WebGUI::URL;
|
|||
sub process {
|
||||
my ($sth, %data, $output);
|
||||
tie %data, 'Tie::CPHash';
|
||||
%data = WebGUI::SQL->quickHash("select pageId,parentId,title,urlizedTitle from page where pageId=".($_[0] || $session{page}{parentId}));
|
||||
%data = WebGUI::SQL->quickHash("select pageId,parentId,title,urlizedTitle from page where pageId=".($_[0] || $session{page}{parentId}),WebGUI::SQL->getSlave);
|
||||
if ($data{parentId} == 0) {
|
||||
$output = $data{title} || $session{page}{title};
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ sub process {
|
|||
my ($statement, $format) = WebGUI::Macro::getParams(shift);
|
||||
$format = '^0;' if ($format eq "");
|
||||
if ($statement =~ /^\s*select/i || $statement =~ /^\s*show/i || $statement =~ /^\s*describe/i) {
|
||||
my $sth = WebGUI::SQL->unconditionalRead($statement);
|
||||
my $sth = WebGUI::SQL->unconditionalRead($statement,WebGUI::SQL->getSlave);
|
||||
unless ($sth->errorCode < 1) {
|
||||
return '<p><b>SQL Macro Failed:</b> '.$sth->errorMessage.'<p>';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ sub process {
|
|||
}
|
||||
$temp = WebGUI::URL::append($session{env}{REQUEST_URI},$append);
|
||||
if ($param[1] ne "") {
|
||||
($styleId) = WebGUI::SQL->quickArray("select styleId from style where name=".quote($param[1]));
|
||||
($styleId) = WebGUI::SQL->quickArray("select styleId from style where name=".quote($param[1]),WebGUI::SQL->getSlave);
|
||||
if ($styleId != 0) {
|
||||
$temp = WebGUI::URL::append($temp,'styleId='.$styleId);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue