aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/avatar.php6
-rw-r--r--lib/cleanupavatarjob.php13
-rw-r--r--lib/installer.php2
-rw-r--r--lib/public/avatar.php3
4 files changed, 19 insertions, 5 deletions
diff --git a/lib/avatar.php b/lib/avatar.php
index 9ab905c852e..3621b96e103 100644
--- a/lib/avatar.php
+++ b/lib/avatar.php
@@ -17,7 +17,7 @@ class OC_Avatar {
* @param $size integer size in px of the avatar, defaults to 64
* @return mixed \OC_Image containing the avatar or false if there's no image
*/
- public static function get ($user, $size = 64) {
+ public function get ($user, $size = 64) {
$view = new \OC\Files\View('/'.$user);
if ($view->file_exists('avatar.jpg')) {
@@ -42,7 +42,7 @@ class OC_Avatar {
* @throws \OC\NotSquareException if the image is not square
* @return true on success
*/
- public static function set ($user, $data) {
+ public function set ($user, $data) {
$view = new \OC\Files\View('/'.$user);
$img = new OC_Image($data);
@@ -73,7 +73,7 @@ class OC_Avatar {
* @param $user string user to delete the avatar from
* @return void
*/
- public static function remove ($user) {
+ public function remove ($user) {
$view = new \OC\Files\View('/'.$user);
$view->unlink('avatar.jpg');
$view->unlink('avatar.png');
diff --git a/lib/cleanupavatarjob.php b/lib/cleanupavatarjob.php
new file mode 100644
index 00000000000..16bf263d211
--- /dev/null
+++ b/lib/cleanupavatarjob.php
@@ -0,0 +1,13 @@
+<?php
+
+class CleanUpAvatarJob extends \OC\BackgroundJob\TimedJob {
+
+ public function __construct () {
+ $this->setInterval(7200); // 2 hours
+ }
+
+ public function run ($argument) {
+ // TODO $view
+ // TODO remove ALL the tmpavatars
+ }
+}
diff --git a/lib/installer.php b/lib/installer.php
index 179b279c5b4..a1d2173e22c 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -426,7 +426,7 @@ class OC_Installer{
'OC_API::',
'OC_App::',
'OC_AppConfig::',
- 'OC_Avatar::',
+ 'OC_Avatar',
'OC_BackgroundJob::',
'OC_Config::',
'OC_DB::',
diff --git a/lib/public/avatar.php b/lib/public/avatar.php
index 55eff57d161..649f3240e93 100644
--- a/lib/public/avatar.php
+++ b/lib/public/avatar.php
@@ -10,6 +10,7 @@ namespace OCP;
class Avatar {
public static function get ($user, $size = 64) {
- return \OC_Avatar::get($user, $size);
+ $avatar = new \OC_Avatar();
+ return $avatar->get($user, $size);
}
}