Fix deprecations and errors for nc 27
parent
f46f16f119
commit
4158ddb2db
|
@ -0,0 +1 @@
|
||||||
|
/vendor/
|
|
@ -11,7 +11,7 @@
|
||||||
<screenshot>https://raw.githubusercontent.com/nextcloud/weather/master/screenshots/1.png</screenshot>
|
<screenshot>https://raw.githubusercontent.com/nextcloud/weather/master/screenshots/1.png</screenshot>
|
||||||
<screenshot>https://raw.githubusercontent.com/nextcloud/weather/master/screenshots/2.png</screenshot>
|
<screenshot>https://raw.githubusercontent.com/nextcloud/weather/master/screenshots/2.png</screenshot>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<nextcloud min-version="22" max-version="26"/>
|
<nextcloud min-version="22" max-version="27"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<website>https://github.com/nextcloud/weather</website>
|
<website>https://github.com/nextcloud/weather</website>
|
||||||
<bugs>https://github.com/nextcloud/weather/issues</bugs>
|
<bugs>https://github.com/nextcloud/weather/issues</bugs>
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
<settings>
|
<settings>
|
||||||
<admin>OCA\Weather\Settings\AdminSettings</admin>
|
<admin>OCA\Weather\Settings\AdminSettings</admin>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
||||||
<navigations>
|
<navigations>
|
||||||
<navigation>
|
<navigation>
|
||||||
<id>weather</id>
|
<id>weather</id>
|
||||||
|
@ -27,5 +28,5 @@
|
||||||
<route>weather.city.index</route>
|
<route>weather.city.index</route>
|
||||||
<icon>app.svg</icon>
|
<icon>app.svg</icon>
|
||||||
</navigation>
|
</navigation>
|
||||||
</navigations>
|
</navigations>
|
||||||
</info>
|
</info>
|
||||||
|
|
|
@ -11,9 +11,8 @@
|
||||||
|
|
||||||
namespace OCA\Weather\AppInfo;
|
namespace OCA\Weather\AppInfo;
|
||||||
|
|
||||||
$application = new Application();
|
return [
|
||||||
|
'routes' => [
|
||||||
$application->registerRoutes($this, array('routes' => array(
|
|
||||||
array('name' => 'city#index', 'url' => '/', 'verb' => 'GET'),
|
array('name' => 'city#index', 'url' => '/', 'verb' => 'GET'),
|
||||||
|
|
||||||
array('name' => 'city#getall', 'url' => '/city/getall', 'verb' => 'GET'),
|
array('name' => 'city#getall', 'url' => '/city/getall', 'verb' => 'GET'),
|
||||||
|
@ -26,5 +25,7 @@ $application->registerRoutes($this, array('routes' => array(
|
||||||
array('name' => 'settings#apikeyset', 'url' => '/settings/apikey', 'verb' => 'POST'),
|
array('name' => 'settings#apikeyset', 'url' => '/settings/apikey', 'verb' => 'POST'),
|
||||||
array('name' => 'settings#metricset', 'url' => '/settings/metric/set','verb' => 'POST'),
|
array('name' => 'settings#metricset', 'url' => '/settings/metric/set','verb' => 'POST'),
|
||||||
array('name' => 'settings#metricget', 'url' => '/settings/metric/get','verb' => 'GET'),
|
array('name' => 'settings#metricget', 'url' => '/settings/metric/get','verb' => 'GET'),
|
||||||
)));
|
]
|
||||||
|
];
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"name": "nextcloud/weather",
|
||||||
|
"description": "Weather app for nextcloud",
|
||||||
|
"type": "project",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "RPJosh",
|
||||||
|
"email": "RPJosh@rpjosh.de"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {},
|
||||||
|
"require-dev": {
|
||||||
|
"nextcloud/ocp": "dev-master"
|
||||||
|
},
|
||||||
|
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"OCP\\": "vendor/nextcloud/ocp/OCP"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,267 @@
|
||||||
|
{
|
||||||
|
"_readme": [
|
||||||
|
"This file locks the dependencies of your project to a known state",
|
||||||
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
|
"This file is @generated automatically"
|
||||||
|
],
|
||||||
|
"content-hash": "8b472dc0ee79104cbd69c0b2d4ac2b4f",
|
||||||
|
"packages": [],
|
||||||
|
"packages-dev": [
|
||||||
|
{
|
||||||
|
"name": "nextcloud/ocp",
|
||||||
|
"version": "dev-master",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/nextcloud-deps/ocp.git",
|
||||||
|
"reference": "e1882fc96e3676e7628eaa82f1f8294c0d778db2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/e1882fc96e3676e7628eaa82f1f8294c0d778db2",
|
||||||
|
"reference": "e1882fc96e3676e7628eaa82f1f8294c0d778db2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "~8.0 || ~8.1 || ~8.2",
|
||||||
|
"psr/clock": "^1.0",
|
||||||
|
"psr/container": "^2.0.2",
|
||||||
|
"psr/event-dispatcher": "^1.0",
|
||||||
|
"psr/log": "^1.1.4"
|
||||||
|
},
|
||||||
|
"default-branch": true,
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "28.0.0-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"AGPL-3.0-or-later"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Christoph Wurst",
|
||||||
|
"email": "christoph@winzerhof-wurst.at"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Composer package containing Nextcloud's public API (classes, interfaces)",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/nextcloud-deps/ocp/issues",
|
||||||
|
"source": "https://github.com/nextcloud-deps/ocp/tree/master"
|
||||||
|
},
|
||||||
|
"time": "2023-07-22T00:39:08+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/clock",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/clock.git",
|
||||||
|
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d",
|
||||||
|
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.0 || ^8.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psr\\Clock\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "https://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Common interface for reading the clock.",
|
||||||
|
"homepage": "https://github.com/php-fig/clock",
|
||||||
|
"keywords": [
|
||||||
|
"clock",
|
||||||
|
"now",
|
||||||
|
"psr",
|
||||||
|
"psr-20",
|
||||||
|
"time"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/php-fig/clock/issues",
|
||||||
|
"source": "https://github.com/php-fig/clock/tree/1.0.0"
|
||||||
|
},
|
||||||
|
"time": "2022-11-25T14:36:26+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/container",
|
||||||
|
"version": "2.0.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/container.git",
|
||||||
|
"reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963",
|
||||||
|
"reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.4.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psr\\Container\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "https://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Common Container Interface (PHP FIG PSR-11)",
|
||||||
|
"homepage": "https://github.com/php-fig/container",
|
||||||
|
"keywords": [
|
||||||
|
"PSR-11",
|
||||||
|
"container",
|
||||||
|
"container-interface",
|
||||||
|
"container-interop",
|
||||||
|
"psr"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/php-fig/container/issues",
|
||||||
|
"source": "https://github.com/php-fig/container/tree/2.0.2"
|
||||||
|
},
|
||||||
|
"time": "2021-11-05T16:47:00+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/event-dispatcher",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/event-dispatcher.git",
|
||||||
|
"reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0",
|
||||||
|
"reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.2.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psr\\EventDispatcher\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "http://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Standard interfaces for event handling.",
|
||||||
|
"keywords": [
|
||||||
|
"events",
|
||||||
|
"psr",
|
||||||
|
"psr-14"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/php-fig/event-dispatcher/issues",
|
||||||
|
"source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0"
|
||||||
|
},
|
||||||
|
"time": "2019-01-08T18:20:26+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/log",
|
||||||
|
"version": "1.1.4",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/log.git",
|
||||||
|
"reference": "d49695b909c3b7628b6289db5479a1c204601f11"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
|
||||||
|
"reference": "d49695b909c3b7628b6289db5479a1c204601f11",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.1.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psr\\Log\\": "Psr/Log/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "https://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Common interface for logging libraries",
|
||||||
|
"homepage": "https://github.com/php-fig/log",
|
||||||
|
"keywords": [
|
||||||
|
"log",
|
||||||
|
"psr",
|
||||||
|
"psr-3"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/php-fig/log/tree/1.1.4"
|
||||||
|
},
|
||||||
|
"time": "2021-05-03T11:20:27+00:00"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"aliases": [],
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"stability-flags": {
|
||||||
|
"nextcloud/ocp": 20
|
||||||
|
},
|
||||||
|
"prefer-stable": false,
|
||||||
|
"prefer-lowest": false,
|
||||||
|
"platform": [],
|
||||||
|
"platform-dev": [],
|
||||||
|
"plugin-api-version": "2.2.0"
|
||||||
|
}
|
|
@ -13,84 +13,92 @@
|
||||||
namespace OCA\Weather\AppInfo;
|
namespace OCA\Weather\AppInfo;
|
||||||
|
|
||||||
use \OCP\AppFramework\App;
|
use \OCP\AppFramework\App;
|
||||||
use \OCP\IContainer;
|
use Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
use \OCA\Weather\Controller\CityController;
|
use OCA\Weather\Controller\CityController;
|
||||||
use \OCA\Weather\Controller\SettingsController;
|
use OCA\Weather\Controller\SettingsController;
|
||||||
use \OCA\Weather\Controller\WeatherController;
|
use OCA\Weather\Controller\WeatherController;
|
||||||
|
|
||||||
use \OCA\Weather\Db\CityMapper;
|
use OCA\Weather\Db\CityMapper;
|
||||||
use \OCA\Weather\Db\SettingsMapper;
|
use OCA\Weather\Db\SettingsMapper;
|
||||||
|
use OCP\AppFramework\Bootstrap\IBootContext;
|
||||||
|
use OCP\AppFramework\Bootstrap\IBootstrap;
|
||||||
|
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
||||||
|
use OCP\IUserSession;
|
||||||
|
use OC\User\Session;
|
||||||
|
|
||||||
class Application extends App {
|
class Application extends App implements IBootstrap {
|
||||||
|
|
||||||
public function __construct (array $urlParams=array()) {
|
public function __construct (array $urlParams = []) {
|
||||||
parent::__construct('weather', $urlParams);
|
parent::__construct('weather', $urlParams);
|
||||||
|
}
|
||||||
|
|
||||||
$container = $this->getContainer();
|
public function register(IRegistrationContext $context): void {
|
||||||
|
|
||||||
/**
|
$context->registerService('UserId', function(ContainerInterface $c) {
|
||||||
* Core
|
/** @var Session */
|
||||||
*/
|
$userSession = $c->get(IUserSession::class);
|
||||||
$container->registerService('UserId', function(IContainer $c) {
|
|
||||||
$user = $c->getServer()->getUserSession()->getUser();
|
return $userSession->getUser() ? $userSession->getUser()->getUID() : null;
|
||||||
return $user ? $user->getUID() : null;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$container->registerService('Config', function($c) {
|
$context->registerService('Config', function(ContainerInterface $c) {
|
||||||
return $c->query('ServerContainer')->getConfig();
|
return $c->get('ServerContainer')->getConfig();
|
||||||
});
|
});
|
||||||
|
|
||||||
$container->registerService('L10N', function($c) {
|
$context->registerService('L10N', function(ContainerInterface $c) {
|
||||||
return $c->query('ServerContainer')->getL10N($c->query('AppName'));
|
return $c->get('ServerContainer')->getL10N($c->get('AppName'));
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database Layer
|
* Database Layer
|
||||||
*/
|
*/
|
||||||
$container->registerService('CityMapper', function(IContainer $c) {
|
$context->registerService('CityMapper', function(ContainerInterface $c) {
|
||||||
return new CityMapper($c->query('ServerContainer')->getDatabaseConnection());
|
return new CityMapper($c->get('ServerContainer')->getDatabaseConnection());
|
||||||
});
|
});
|
||||||
|
|
||||||
$container->registerService('SettingsMapper', function(IContainer $c) {
|
$context->registerService('SettingsMapper', function(ContainerInterface $c) {
|
||||||
return new SettingsMapper($c->query('ServerContainer')->getDatabaseConnection());
|
return new SettingsMapper($c->get('ServerContainer')->getDatabaseConnection());
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controllers
|
* Controllers
|
||||||
*/
|
*/
|
||||||
$container->registerService('CityController', function(IContainer $c) {
|
$context->registerService('CityController', function(ContainerInterface $c) {
|
||||||
return new CityController(
|
return new CityController(
|
||||||
$c->query('AppName'),
|
$c->get('AppName'),
|
||||||
$c->query('Config'),
|
$c->get('Config'),
|
||||||
$c->query('Request'),
|
$c->get('Request'),
|
||||||
$c->query('UserId'),
|
$c->get('UserId'),
|
||||||
$c->query('CityMapper'),
|
$c->get('CityMapper'),
|
||||||
$c->query('SettingsMapper')
|
$c->get('SettingsMapper')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$container->registerService('SettingsController', function(IContainer $c) {
|
$context->registerService('SettingsController', function(ContainerInterface $c) {
|
||||||
return new SettingsController(
|
return new SettingsController(
|
||||||
$c->query('AppName'),
|
$c->get('AppName'),
|
||||||
$c->query('Config'),
|
$c->get('Config'),
|
||||||
$c->query('Request'),
|
$c->get('Request'),
|
||||||
$c->query('UserId'),
|
$c->get('UserId'),
|
||||||
$c->query('SettingsMapper'),
|
$c->get('SettingsMapper'),
|
||||||
$c->query('CityMapper')
|
$c->get('CityMapper')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$container->registerService('WeatherController', function(IContainer $c) {
|
$context->registerService('WeatherController', function(ContainerInterface $c) {
|
||||||
return new WeatherController(
|
return new WeatherController(
|
||||||
$c->query('AppName'),
|
$c->get('AppName'),
|
||||||
$c->query('Config'),
|
$c->get('Config'),
|
||||||
$c->query('Request'),
|
$c->get('Request'),
|
||||||
$c->query('UserId'),
|
$c->get('UserId'),
|
||||||
$c->query('CityMapper'),
|
$c->get('CityMapper'),
|
||||||
$c->query('SettingsMapper'),
|
$c->get('SettingsMapper'),
|
||||||
$c->query('L10N')
|
$c->get('L10N')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function boot(IBootContext $context): void {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ use \OCP\IDBConnection;
|
||||||
use \OCP\AppFramework\Db\QbMapper;
|
use \OCP\AppFramework\Db\QbMapper;
|
||||||
|
|
||||||
class CityMapper extends QbMapper {
|
class CityMapper extends QbMapper {
|
||||||
|
|
||||||
public function __construct (IDBConnection $db) {
|
public function __construct (IDBConnection $db) {
|
||||||
parent::__construct($db, 'weather_city');
|
parent::__construct($db, 'weather_city');
|
||||||
}
|
}
|
||||||
|
@ -70,4 +71,5 @@ class CityMapper extends QbMapper {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -17,6 +17,7 @@ use \OCP\IDBConnection;
|
||||||
use \OCP\AppFramework\Db\QbMapper;
|
use \OCP\AppFramework\Db\QbMapper;
|
||||||
|
|
||||||
class SettingsMapper extends QbMapper {
|
class SettingsMapper extends QbMapper {
|
||||||
|
|
||||||
public function __construct (IDBConnection $db) {
|
public function __construct (IDBConnection $db) {
|
||||||
parent::__construct($db, 'weather_config');
|
parent::__construct($db, 'weather_config');
|
||||||
}
|
}
|
Loading…
Reference in New Issue