Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
ShareStore: make sure to check if sqlSupported before using $this->co…
Browse files Browse the repository at this point in the history
…nfStorage
  • Loading branch information
cdujeu committed Nov 20, 2014
1 parent f412d40 commit 4bcd495
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 2 additions & 0 deletions core/src/.htaccess
Expand Up @@ -23,3 +23,5 @@ RewriteRule (.*) index.php [L]
#RewriteCond %{HTTP:Authorization} ^(.*)
#RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
</IfModule>

AddType application/json .json
21 changes: 13 additions & 8 deletions core/src/plugins/action.share/class.ShareStore.php
Expand Up @@ -164,6 +164,7 @@ public function shareIsLegacy($hash){
}

public function updateShareProperty($hash, $pName, $pValue){
if(!$this->sqlSupported) return false;
$relatedObjectId = $this->confStorage->simpleStoreGet("share", $hash, "serial", $data);
if(is_array($data)){
$data[$pName] = $pValue;
Expand All @@ -174,6 +175,7 @@ public function updateShareProperty($hash, $pName, $pValue){
}

public function findSharesForRepo($repositoryId){
if(!$this->sqlSupported) return array();
return $this->confStorage->simpleStoreList("share", null, "", "serial", '%"REPOSITORY";s:32:"'.$repositoryId.'"%');
}

Expand All @@ -189,14 +191,17 @@ protected function updateShareType(&$shareData){

public function listShares($limitToUser = '', $parentRepository = '', $cursor = null, $shareType = null){

// Get DB files
$dbLets = $this->confStorage->simpleStoreList(
"share",
$cursor,
"",
"serial",
(!empty($limitToUser)?'%"OWNER_ID";s:'.strlen($limitToUser).':"'.$limitToUser.'"%':''),
$parentRepository);
$dbLets = array();
if($this->sqlSupported){
// Get DB files
$dbLets = $this->confStorage->simpleStoreList(
"share",
$cursor,
"",
"serial",
(!empty($limitToUser)?'%"OWNER_ID";s:'.strlen($limitToUser).':"'.$limitToUser.'"%':''),
$parentRepository);
}

// Get hardcoded files
$files = glob(ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER")."/*.php");
Expand Down

0 comments on commit 4bcd495

Please sign in to comment.