remove unused variables

This commit is contained in:
Robin Appelman 2012-07-20 18:56:18 +02:00
parent 7152b8b4ee
commit c9be9ab251
25 changed files with 39 additions and 82 deletions

View File

@ -31,9 +31,7 @@ class OC_CryptStream{
public static $sourceStreams=array(); public static $sourceStreams=array();
private $source; private $source;
private $path; private $path;
private $readBuffer;//for streams that dont support seeking
private $meta=array();//header/meta for source stream private $meta=array();//header/meta for source stream
private $count;
private $writeCache; private $writeCache;
private $size; private $size;
private static $rootView; private static $rootView;
@ -100,7 +98,6 @@ class OC_CryptStream{
public function stream_write($data){ public function stream_write($data){
$length=strlen($data); $length=strlen($data);
$written=0;
$currentPos=ftell($this->source); $currentPos=ftell($this->source);
if($this->writeCache){ if($this->writeCache){
$data=$this->writeCache.$data; $data=$this->writeCache.$data;

View File

@ -15,8 +15,6 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{
private $root; private $root;
private $share; private $share;
private static $tempFiles=array();
public function __construct($params){ public function __construct($params){
$this->host=$params['host']; $this->host=$params['host'];
$this->user=$params['user']; $this->user=$params['user'];

View File

@ -13,7 +13,6 @@ if(!is_array($config) or !isset($config['ftp']) or !$config['ftp']['run']){
}else{ }else{
class Test_Filestorage_FTP extends Test_FileStorage { class Test_Filestorage_FTP extends Test_FileStorage {
private $config; private $config;
private $id;
public function setUp(){ public function setUp(){
$id=uniqid(); $id=uniqid();

View File

@ -28,7 +28,6 @@ if(!is_array($config) or !isset($config['google']) or !$config['google']['run'])
class Test_Filestorage_Google extends Test_FileStorage { class Test_Filestorage_Google extends Test_FileStorage {
private $config; private $config;
private $id;
public function setUp(){ public function setUp(){
$id=uniqid(); $id=uniqid();

View File

@ -14,7 +14,6 @@ if(!is_array($config) or !isset($config['smb']) or !$config['smb']['run']){
}else{ }else{
class Test_Filestorage_SMB extends Test_FileStorage { class Test_Filestorage_SMB extends Test_FileStorage {
private $config; private $config;
private $id;
public function setUp(){ public function setUp(){
$id=uniqid(); $id=uniqid();

View File

@ -13,7 +13,6 @@ if(!is_array($config) or !isset($config['swift']) or !$config['swift']['run']){
}else{ }else{
class Test_Filestorage_SWIFT extends Test_FileStorage { class Test_Filestorage_SWIFT extends Test_FileStorage {
private $config; private $config;
private $id;
public function setUp(){ public function setUp(){
$id=uniqid(); $id=uniqid();

View File

@ -13,7 +13,6 @@ if(!is_array($config) or !isset($config['webdav']) or !$config['webdav']['run'])
}else{ }else{
class Test_Filestorage_DAV extends Test_FileStorage { class Test_Filestorage_DAV extends Test_FileStorage {
private $config; private $config;
private $id;
public function setUp(){ public function setUp(){
$id=uniqid(); $id=uniqid();

View File

@ -58,7 +58,7 @@ class OC_Gallery_Album {
return $stmt->execute($args); return $stmt->execute($args);
} }
public static function removeByName($owner, $name) { self::remove($ownmer, $name); } public static function removeByName($owner, $name) { self::remove($owner, $name); }
public static function removeByPath($owner, $path) { self::remove($owner, null, $path); } public static function removeByPath($owner, $path) { self::remove($owner, null, $path); }
public static function removeByParentPath($owner, $parent) { self::remove($owner, null, null, $parent); } public static function removeByParentPath($owner, $parent) { self::remove($owner, null, null, $parent); }

View File

@ -29,7 +29,6 @@ class DatabaseManager {
$stmt = \OCP\DB::prepare('INSERT INTO *PREFIX*pictures_images_cache (uid_owner, path, width, height) VALUES (?, ?, ?, ?)'); $stmt = \OCP\DB::prepare('INSERT INTO *PREFIX*pictures_images_cache (uid_owner, path, width, height) VALUES (?, ?, ?, ?)');
$stmt->execute(array(\OCP\USER::getUser(), $path, $width, $height)); $stmt->execute(array(\OCP\USER::getUser(), $path, $width, $height));
$ret = array('path' => $path, 'width' => $width, 'height' => $height); $ret = array('path' => $path, 'width' => $width, 'height' => $height);
unset($image);
$dir = dirname($path); $dir = dirname($path);
$this->cache[$dir][$path] = $ret; $this->cache[$dir][$path] = $ret;
return $ret; return $ret;

View File

@ -33,7 +33,7 @@ class TilesLine {
} }
public function setAvailableSpace($space) { public function setAvailableSpace($space) {
$available_space = $space; $this->available_space = $space;
} }
public function getTilesCount() { public function getTilesCount() {

View File

@ -271,7 +271,6 @@ class OC_MEDIA_AMPACHE{
</root>"); </root>");
return; return;
} }
global $SITEROOT;
$filter=$params['filter']; $filter=$params['filter'];
$albums=OC_MEDIA_COLLECTION::getAlbums($filter); $albums=OC_MEDIA_COLLECTION::getAlbums($filter);
$artist=OC_MEDIA_COLLECTION::getArtistName($filter); $artist=OC_MEDIA_COLLECTION::getArtistName($filter);

View File

@ -27,7 +27,6 @@ class OC_MEDIA_COLLECTION{
public static $uid; public static $uid;
private static $artistIdCache=array(); private static $artistIdCache=array();
private static $albumIdCache=array(); private static $albumIdCache=array();
private static $songIdCache=array();
private static $queries=array(); private static $queries=array();
/** /**
@ -152,7 +151,7 @@ class OC_MEDIA_COLLECTION{
return $artistId; return $artistId;
}else{ }else{
$query=OCP\DB::prepare("INSERT INTO `*PREFIX*media_artists` (`artist_name`) VALUES (?)"); $query=OCP\DB::prepare("INSERT INTO `*PREFIX*media_artists` (`artist_name`) VALUES (?)");
$result=$query->execute(array($name)); $query->execute(array($name));
return self::getArtistId($name);; return self::getArtistId($name);;
} }
} }

View File

@ -27,12 +27,12 @@ class OC_MEDIA{
* @param array $params, parameters passed from OC_Hook * @param array $params, parameters passed from OC_Hook
*/ */
public static function loginListener($params){ public static function loginListener($params){
if(isset($_POST['user']) and $_POST['password']){ if(isset($params['uid']) and $params['password']){
$name=$_POST['user']; $name=$params['uid'];
$query=OCP\DB::prepare("SELECT user_id from *PREFIX*media_users WHERE user_id LIKE ?"); $query=OCP\DB::prepare("SELECT user_id from *PREFIX*media_users WHERE user_id LIKE ?");
$uid=$query->execute(array($name))->fetchAll(); $uid=$query->execute(array($name))->fetchAll();
if(count($uid)==0){ if(count($uid)==0){
$password=hash('sha256',$_POST['password']); $password=hash('sha256',$params['password']);
$query=OCP\DB::prepare("INSERT INTO *PREFIX*media_users (user_id, user_password_sha256) VALUES (?, ?);"); $query=OCP\DB::prepare("INSERT INTO *PREFIX*media_users (user_id, user_password_sha256) VALUES (?, ?);");
$query->execute(array($name,$password)); $query->execute(array($name,$password));
} }

View File

@ -17,12 +17,11 @@ class OC_remoteStorage {
$user=OCP\USER::getUser(); $user=OCP\USER::getUser();
$query=OCP\DB::prepare("SELECT token FROM *PREFIX*authtoken WHERE user=? AND appUrl=? AND category=? LIMIT 1"); $query=OCP\DB::prepare("SELECT token FROM *PREFIX*authtoken WHERE user=? AND appUrl=? AND category=? LIMIT 1");
$result=$query->execute(array($user, $appUrl, $categories)); $result=$query->execute(array($user, $appUrl, $categories));
$ret = array();
if($row=$result->fetchRow()) { if($row=$result->fetchRow()) {
return base64_encode('remoteStorage:'.$row['token']); return base64_encode('remoteStorage:'.$row['token']);
} else { } else {
return false; return false;
} }
} }
public static function getAllTokens() { public static function getAllTokens() {
@ -42,13 +41,13 @@ class OC_remoteStorage {
public static function deleteToken($token) { public static function deleteToken($token) {
$user=OCP\USER::getUser(); $user=OCP\USER::getUser();
$query=OCP\DB::prepare("DELETE FROM *PREFIX*authtoken WHERE token=? AND user=?"); $query=OCP\DB::prepare("DELETE FROM *PREFIX*authtoken WHERE token=? AND user=?");
$result=$query->execute(array($token,$user)); $query->execute(array($token,$user));
return 'unknown';//how can we see if any rows were affected? return 'unknown';//how can we see if any rows were affected?
} }
private static function addToken($token, $appUrl, $categories){ private static function addToken($token, $appUrl, $categories){
$user=OCP\USER::getUser(); $user=OCP\USER::getUser();
$query=OCP\DB::prepare("INSERT INTO *PREFIX*authtoken (`token`,`appUrl`,`user`,`category`) VALUES(?,?,?,?)"); $query=OCP\DB::prepare("INSERT INTO *PREFIX*authtoken (`token`,`appUrl`,`user`,`category`) VALUES(?,?,?,?)");
$result=$query->execute(array($token,$appUrl,$user,$categories)); $query->execute(array($token,$appUrl,$user,$categories));
} }
public static function createCategories($appUrl, $categories) { public static function createCategories($appUrl, $categories) {
$token=uniqid(); $token=uniqid();

View File

@ -11,7 +11,6 @@ class OC_Archive_ZIP extends OC_Archive{
* @var ZipArchive zip * @var ZipArchive zip
*/ */
private $zip=null; private $zip=null;
private $success=false;
private $path; private $path;
function __construct($source){ function __construct($source){

View File

@ -207,7 +207,6 @@ class OC_FileCache_Update{
$cached=OC_FileCache_Cached::get($oldPath,$root); $cached=OC_FileCache_Cached::get($oldPath,$root);
$oldSize=$cached['size']; $oldSize=$cached['size'];
$size=$view->filesize($newPath);
OC_FileCache::increaseSize(dirname($oldPath),-$oldSize,$root); OC_FileCache::increaseSize(dirname($oldPath),-$oldSize,$root);
OC_FileCache::increaseSize(dirname($newPath),$oldSize,$root); OC_FileCache::increaseSize(dirname($newPath),$oldSize,$root);
OC_FileCache::move($oldPath,$newPath); OC_FileCache::move($oldPath,$newPath);

View File

@ -220,7 +220,7 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
} }
$tmpFile=OC_Helper::tmpFile($extension); $tmpFile=OC_Helper::tmpFile($extension);
$target=fopen($tmpFile,'w'); $target=fopen($tmpFile,'w');
$count=OC_Helper::streamCopy($source,$target); OC_Helper::streamCopy($source,$target);
return $tmpFile; return $tmpFile;
} }
// abstract public function touch($path, $mtime=null); // abstract public function touch($path, $mtime=null);

View File

@ -41,7 +41,6 @@
* Class for group management in a SQL Database (e.g. MySQL, SQLite) * Class for group management in a SQL Database (e.g. MySQL, SQLite)
*/ */
class OC_Group_Database extends OC_Group_Backend { class OC_Group_Database extends OC_Group_Backend {
private $userGroupCache=array();
/** /**
* @brief Try to create a new group * @brief Try to create a new group
@ -116,7 +115,7 @@ class OC_Group_Database extends OC_Group_Backend {
// No duplicate entries! // No duplicate entries!
if( !$this->inGroup( $uid, $gid )){ if( !$this->inGroup( $uid, $gid )){
$query = OC_DB::prepare( "INSERT INTO `*PREFIX*group_user` ( `uid`, `gid` ) VALUES( ?, ? )" ); $query = OC_DB::prepare( "INSERT INTO `*PREFIX*group_user` ( `uid`, `gid` ) VALUES( ?, ? )" );
$result = $query->execute( array( $uid, $gid )); $query->execute( array( $uid, $gid ));
return true; return true;
}else{ }else{
return false; return false;
@ -133,7 +132,7 @@ class OC_Group_Database extends OC_Group_Backend {
*/ */
public function removeFromGroup( $uid, $gid ){ public function removeFromGroup( $uid, $gid ){
$query = OC_DB::prepare( "DELETE FROM *PREFIX*group_user WHERE uid = ? AND gid = ?" ); $query = OC_DB::prepare( "DELETE FROM *PREFIX*group_user WHERE uid = ? AND gid = ?" );
$result = $query->execute( array( $uid, $gid )); $query->execute( array( $uid, $gid ));
return true; return true;
} }

View File

@ -126,7 +126,8 @@ class OC_Group_Dummy extends OC_Group_Backend {
*/ */
public function getUserGroups($uid){ public function getUserGroups($uid){
$groups=array(); $groups=array();
foreach($this->groups as $group=>$user){ $allGroups=array_keys($this->groups);
foreach($allGroups as $group){
if($this->inGroup($uid,$group)){ if($this->inGroup($uid,$group)){
$groups[]=$group; $groups[]=$group;
} }

View File

@ -34,7 +34,7 @@ abstract class OC_Group_Example {
* Trys to create a new group. If the group name already exists, false will * Trys to create a new group. If the group name already exists, false will
* be returned. * be returned.
*/ */
public static function createGroup($gid){} abstract public static function createGroup($gid);
/** /**
* @brief delete a group * @brief delete a group
@ -43,7 +43,7 @@ abstract class OC_Group_Example {
* *
* Deletes a group and removes it from the group_user-table * Deletes a group and removes it from the group_user-table
*/ */
public static function deleteGroup($gid){} abstract public static function deleteGroup($gid);
/** /**
* @brief is user in group? * @brief is user in group?
@ -53,7 +53,7 @@ abstract class OC_Group_Example {
* *
* Checks whether the user is member of a group or not. * Checks whether the user is member of a group or not.
*/ */
public static function inGroup($uid, $gid){} abstract public static function inGroup($uid, $gid);
/** /**
* @brief Add a user to a group * @brief Add a user to a group
@ -63,7 +63,7 @@ abstract class OC_Group_Example {
* *
* Adds a user to a group. * Adds a user to a group.
*/ */
public static function addToGroup($uid, $gid){} abstract public static function addToGroup($uid, $gid);
/** /**
* @brief Removes a user from a group * @brief Removes a user from a group
@ -73,7 +73,7 @@ abstract class OC_Group_Example {
* *
* removes the user from a group. * removes the user from a group.
*/ */
public static function removeFromGroup($uid,$gid){} abstract public static function removeFromGroup($uid,$gid);
/** /**
* @brief Get all groups a user belongs to * @brief Get all groups a user belongs to
@ -83,7 +83,7 @@ abstract class OC_Group_Example {
* This function fetches all groups a user belongs to. It does not check * This function fetches all groups a user belongs to. It does not check
* if the user exists at all. * if the user exists at all.
*/ */
public static function getUserGroups($uid){} abstract public static function getUserGroups($uid);
/** /**
* @brief get a list of all groups * @brief get a list of all groups
@ -91,19 +91,19 @@ abstract class OC_Group_Example {
* *
* Returns a list with all groups * Returns a list with all groups
*/ */
public static function getGroups(){} abstract public static function getGroups();
/** /**
* check if a group exists * check if a group exists
* @param string $gid * @param string $gid
* @return bool * @return bool
*/ */
public function groupExists($gid){} public function groupExists($gid);
/** /**
* @brief get a list of all users in a group * @brief get a list of all users in a group
* @returns array with user ids * @returns array with user ids
*/ */
public static function usersInGroup($gid){} abstract public static function usersInGroup($gid);
} }

View File

@ -34,28 +34,6 @@ namespace OCP;
* This class provides functions to manage apps in ownCloud * This class provides functions to manage apps in ownCloud
*/ */
class App { class App {
/**
* @brief Makes owncloud aware of this app
* @brief This call is deprecated and not necessary to use.
* @param $data array with all information
* @returns true/false
*
* This function registers the application. $data is an associative array.
* The following keys are required:
* - id: id of the application, has to be unique ('addressbook')
* - name: Human readable name ('Addressbook')
* - version: array with Version (major, minor, bugfix) ( array(1, 0, 2))
*
* The following keys are optional:
* - order: integer, that influences the position of your application in
* a list of applications. Lower values come first.
*
*/
public static function register( $data ){
}
/** /**
* @brief adds an entry to the navigation * @brief adds an entry to the navigation
* @param $data array containing the data * @param $data array containing the data

View File

@ -2,13 +2,17 @@
/** /**
* provides search functionalty * provides search functionalty
*/ */
class OC_Search_Provider { abstract class OC_Search_Provider {
public function __construct($options){} private $options;
public function __construct($options){
$this->options=$options;
}
/** /**
* search for $query * search for $query
* @param string $query * @param string $query
* @return array An array of OC_Search_Result's * @return array An array of OC_Search_Result's
*/ */
public function search($query){} abstract public function search($query);
} }

View File

@ -39,7 +39,6 @@ require_once 'phpass/PasswordHash.php';
* Class for user management in a SQL Database (e.g. MySQL, SQLite) * Class for user management in a SQL Database (e.g. MySQL, SQLite)
*/ */
class OC_User_Database extends OC_User_Backend { class OC_User_Database extends OC_User_Backend {
static private $userGroupCache=array();
/** /**
* @var PasswordHash * @var PasswordHash
*/ */
@ -87,7 +86,7 @@ class OC_User_Database extends OC_User_Backend {
public function deleteUser( $uid ){ public function deleteUser( $uid ){
// Delete user-group-relation // Delete user-group-relation
$query = OC_DB::prepare( "DELETE FROM `*PREFIX*users` WHERE uid = ?" ); $query = OC_DB::prepare( "DELETE FROM `*PREFIX*users` WHERE uid = ?" );
$result = $query->execute( array( $uid )); $query->execute( array( $uid ));
return true; return true;
} }
@ -104,11 +103,10 @@ class OC_User_Database extends OC_User_Backend {
$hasher=$this->getHasher(); $hasher=$this->getHasher();
$hash = $hasher->HashPassword($password.OC_Config::getValue('passwordsalt', '')); $hash = $hasher->HashPassword($password.OC_Config::getValue('passwordsalt', ''));
$query = OC_DB::prepare( "UPDATE *PREFIX*users SET password = ? WHERE uid = ?" ); $query = OC_DB::prepare( "UPDATE *PREFIX*users SET password = ? WHERE uid = ?" );
$result = $query->execute( array( $hash, $uid )); $query->execute( array( $hash, $uid ));
return true; return true;
} }else{
else{
return false; return false;
} }
} }

View File

@ -35,9 +35,7 @@ abstract class OC_User_Example extends OC_User_Backend {
* Creates a new user. Basic checking of username is done in OC_User * Creates a new user. Basic checking of username is done in OC_User
* itself, not in its subclasses. * itself, not in its subclasses.
*/ */
public function createUser($uid, $password){ abstract public function createUser($uid, $password);
return OC_USER_BACKEND_NOT_IMPLEMENTED;
}
/** /**
* @brief Set password * @brief Set password
@ -47,9 +45,7 @@ abstract class OC_User_Example extends OC_User_Backend {
* *
* Change the password of a user * Change the password of a user
*/ */
public function setPassword($uid, $password){ abstract public function setPassword($uid, $password);
return OC_USER_BACKEND_NOT_IMPLEMENTED;
}
/** /**
* @brief Check if the password is correct * @brief Check if the password is correct
@ -60,7 +56,5 @@ abstract class OC_User_Example extends OC_User_Backend {
* Check if the password is correct without logging in the user * Check if the password is correct without logging in the user
* returns the user id or false * returns the user id or false
*/ */
public function checkPassword($uid, $password){ abstract public function checkPassword($uid, $password);
return OC_USER_BACKEND_NOT_IMPLEMENTED;
}
} }

View File

@ -21,7 +21,6 @@
*/ */
class Test_User_Database extends Test_User_Backend { class Test_User_Database extends Test_User_Backend {
private $user=array();
/** /**
* get a new unique user name * get a new unique user name
* test cases can override this in order to clean up created user * test cases can override this in order to clean up created user