Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 116 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ jobs:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install --verbose --database=mysql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
./occ maintenance:install --verbose --database=mysql --database-name=nextcloud \
--database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword \
--admin-user admin --admin-pass admin
./occ app:enable --force ${{ env.APP_NAME }}
./occ app:enable notifications
./occ app:enable --force ${{ env.APP_NAME }}
Expand Down Expand Up @@ -254,11 +256,123 @@ jobs:
path: data/nextcloud.log
if-no-files-found: warn

nc-py-api-oci:
runs-on: ubuntu-22.04
name: NC_Py_API • stable28 • 8.2 • Oracle

services:
oracle:
image: ghcr.io/gvenzl/oracle-xe:11
env:
ORACLE_RANDOM_PASSWORD: true
APP_USER: useroracle
APP_USER_PASSWORD: userpassword
options: >-
--health-cmd healthcheck.sh
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 1521:1521/tcp

steps:
- uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Set app env
run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV

- name: Checkout server
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
repository: nextcloud/server
ref: stable28

- name: Checkout Notifications
uses: actions/checkout@v3
with:
repository: nextcloud/notifications
ref: stable28
path: apps/notifications

- name: Checkout AppAPI
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
path: apps/${{ env.APP_NAME }}

- name: Set up php
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, \
posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, oci8

- name: Check composer file existence
id: check_composer
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
with:
files: apps/${{ env.APP_NAME }}/composer.json

- name: Set up dependencies
if: steps.check_composer.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: composer i

- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install --verbose --database=oci --database-name=XE \
--database-host=127.0.0.1 --database-port=1521 --database-user=useroracle --database-pass=userpassword \
--admin-user admin --admin-pass admin
./occ app:enable --force ${{ env.APP_NAME }}
./occ app:enable notifications
./occ app:enable --force ${{ env.APP_NAME }}

- name: Run Nextcloud
run: PHP_CLI_SERVER_WORKERS=2 php -S 127.0.0.1:8080 &

- name: Checkout NcPyApi
uses: actions/checkout@v3
with:
path: nc_py_api
repository: cloud-py-api/nc_py_api

- name: Install NcPyApi
working-directory: nc_py_api
run: python3 -m pip -v install ".[dev]"

- name: Register NcPyApi
run: |
cd nc_py_api
python3 tests/_install.py &
echo $! > /tmp/_install.pid
python3 tests/_install_wait.py http://127.0.0.1:$APP_PORT/heartbeat "\"status\":\"ok\"" 15 0.5
cd ..
sh nc_py_api/scripts/ci_register.sh "$APP_ID" "$APP_VERSION" "$APP_SECRET" "localhost" "$APP_PORT"
kill -15 $(cat /tmp/_install.pid)
timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null

- name: Run NC_Py_API tests
working-directory: nc_py_api
run: python3 -m pytest

- name: Upload NC logs
if: always()
uses: actions/upload-artifact@v3
with:
name: oci_nc_py_api_stable28_8.2_nextcloud.log
path: data/nextcloud.log
if-no-files-found: warn

tests-success:
permissions:
contents: none
runs-on: ubuntu-22.04
needs: [nc-py-api-pgsql, nc-py-api-mysql]
needs: [nc-py-api-pgsql, nc-py-api-mysql, nc-py-api-oci]
name: Tests-OK
steps:
- run: echo "Tests passed successfully"
4 changes: 2 additions & 2 deletions lib/Controller/OCSUiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ public function getFileActionMenu(string $name): DataResponse {
#[NoCSRFRequired]
public function registerExAppMenuEntry(
string $name, string $displayName,
string $iconUrl = '', int $adminRequired = 0): DataResponse {
string $icon = '', int $adminRequired = 0): DataResponse {
$result = $this->menuEntryService->registerExAppMenuEntry(
$this->request->getHeader('EX-APP-ID'), $name, $displayName, $iconUrl, $adminRequired);
$this->request->getHeader('EX-APP-ID'), $name, $displayName, $icon, $adminRequired);
if (!$result) {
throw new OCSBadRequestException("Top Menu entry could not be registered");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace OCA\AppAPI\Db;
namespace OCA\AppAPI\Db\UI;

use JsonSerializable;
use OCP\AppFramework\Db\Entity;
Expand Down Expand Up @@ -31,7 +31,7 @@
* @method void setIconClass(string $iconClass)
* @method void setActionHandler(string $actionHandler)
*/
class ExFilesActionsMenu extends Entity implements JsonSerializable {
class FilesActionsMenu extends Entity implements JsonSerializable {
protected $appid;
protected $name;
protected $displayName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace OCA\AppAPI\Db;
namespace OCA\AppAPI\Db\UI;

use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
Expand All @@ -12,9 +12,9 @@
use OCP\IDBConnection;

/**
* @template-extends QBMapper<ExFilesActionsMenu>
* @template-extends QBMapper<FilesActionsMenu>
*/
class ExFilesActionsMenuMapper extends QBMapper {
class FilesActionsMenuMapper extends QBMapper {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'ex_files_actions_menu');
}
Expand Down Expand Up @@ -48,13 +48,13 @@ public function findAllEnabled(): array {
* @param string $appId
* @param string $name
*
* @throws MultipleObjectsReturnedException if more than one result
* @return FilesActionsMenu
* @throws DoesNotExistException if not found
* @throws Exception
*
* @return ExFilesActionsMenu
* @throws MultipleObjectsReturnedException if more than one result
*/
public function findByAppidName(string $appId, string $name): ExFilesActionsMenu {
public function findByAppidName(string $appId, string $name): FilesActionsMenu {
$qb = $this->db->getQueryBuilder();
$qb->select('*')
->from($this->tableName)
Expand All @@ -69,13 +69,13 @@ public function findByAppidName(string $appId, string $name): ExFilesActionsMenu
* @param string $name
*
*
* @throws MultipleObjectsReturnedException if more than one result
* @return FilesActionsMenu
* @throws DoesNotExistException|Exception if not found
* @throws Exception
*
* @return ExFilesActionsMenu
* @throws MultipleObjectsReturnedException if more than one result
*/
public function findByName(string $name): ExFilesActionsMenu {
public function findByName(string $name): FilesActionsMenu {
$qb = $this->db->getQueryBuilder();
$qb->select('*')
->from($this->tableName)
Expand Down
16 changes: 8 additions & 8 deletions lib/Db/UI/TopMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
* @method string getAppid()
* @method string getName()
* @method string getDisplayName()
* @method string getIconUrl()
* @method string getIcon()
* @method int getAdminRequired()
* @method void setAppid(string $appid)
* @method void setName(string $name)
* @method void setDisplayName(string $displayName)
* @method void setIconUrl(string $iconUrl)
* @method void setIcon(string $icon)
* @method void setAdminRequired(int $adminRequired)
*/
class TopMenu extends Entity implements JsonSerializable {
protected $appid;
protected $name;
protected $displayName;
protected $iconUrl;
protected $icon;
protected $adminRequired;

/**
Expand All @@ -37,8 +37,8 @@ public function __construct(array $params = []) {
$this->addType('appid', 'string');
$this->addType('name', 'string');
$this->addType('display_name', 'string');
$this->addType('icon_url', 'string');
$this->addType('admin_required', 'integer');
$this->addType('icon', 'string');
$this->addType('admin_required', 'int');

if (isset($params['id'])) {
$this->setId($params['id']);
Expand All @@ -52,8 +52,8 @@ public function __construct(array $params = []) {
if (isset($params['display_name'])) {
$this->setDisplayName($params['display_name']);
}
if (isset($params['icon_url'])) {
$this->setIconUrl($params['icon_url']);
if (isset($params['icon'])) {
$this->setIcon($params['icon']);
}
if (isset($params['admin_required'])) {
$this->setAdminRequired($params['admin_required']);
Expand All @@ -66,7 +66,7 @@ public function jsonSerialize(): array {
'appid' => $this->getAppid(),
'name' => $this->getName(),
'display_name' => $this->getDisplayName(),
'icon_url' => $this->getIconUrl(),
'icon' => $this->getIcon(),
'admin_required' => $this->getAdminRequired(),
];
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/UI/TopMenuMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function findAllEnabled(): array {
'menu_entries.appid',
'menu_entries.name',
'menu_entries.display_name',
'menu_entries.icon_url',
'menu_entries.icon',
'menu_entries.admin_required',
)
->from($this->tableName, 'menu_entries')
Expand Down
2 changes: 1 addition & 1 deletion lib/Migration/Version1000Date202305221555.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
'default' => 0,
]);
$table->addColumn('icon', Types::STRING, [
'notnull' => true,
'notnull' => false,
'default' => '',
]);
$table->addColumn('icon_class', Types::STRING, [
Expand Down
5 changes: 3 additions & 2 deletions lib/Migration/Version1003Date202311061844.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
'notnull' => true,
'length' => 32,
]);
$table->addColumn('icon_url', Types::STRING, [
'notnull' => true,
$table->addColumn('icon', Types::STRING, [
'notnull' => false,
'default' => '',
]);
$table->addColumn('admin_required', Types::SMALLINT, [
'notnull' => true,
'default' => 0,
'length' => 1,
]);

$table->setPrimaryKey(['id']);
Expand Down
Loading