From 138ee88486f194fdec1f647aefebf21232065748 Mon Sep 17 00:00:00 2001 From: Dillard Blom Date: Sat, 26 Sep 2026 12:51:21 +0200 Subject: [PATCH] Rename app id from occweb to extended_occweb, prep for App Store Nextcloud's app id "occweb" is effectively unavailable for a new store listing: the original Adphi/occweb still owns that App Store slot (stale, v0.2.3), and el-choco/occweb_v2 has since published a same-lineage rewrite under its own id. Rather than fight over the "occweb" name, publish this fork under its own id, matching the this app has always had: "Extended OCC Web". Renames every place the literal app id is used: info.xml and the auto-generated navigation , script()/style() registrations in templates/index.php, the TemplateResponse app name in OccController::index(), the /apps/... base URL in js/index.js, and the 'app' log context tag in DbController.php. The GitHub repo name and its /// links are unaffected - those identify the repo, not the Nextcloud app. Docs (README, INSTALL-AIO.md, install.sh) updated to clone into and reference an "extended_occweb" directory, since Nextcloud requires the app folder name to match its id - a plain `git clone` of this repo no longer produces a correctly-named install directory on its own. Version bump to 0.4.0 given the scope (breaking change for anyone who already deployed under the old "occweb" id - requires disable+remove of the old app and a fresh enable under the new id, not an in-place upgrade). --- INSTALL-AIO.md | 14 +++++++------- README.md | 13 ++++++++----- appinfo/info.xml | 6 +++--- install.sh | 9 +++++---- js/index.js | 2 +- lib/Controller/DbController.php | 20 ++++++++++---------- lib/Controller/OccController.php | 2 +- templates/index.php | 10 +++++----- 8 files changed, 40 insertions(+), 36 deletions(-) diff --git a/INSTALL-AIO.md b/INSTALL-AIO.md index 14547da..6443d9d 100644 --- a/INSTALL-AIO.md +++ b/INSTALL-AIO.md @@ -27,14 +27,14 @@ tar -C "$STAGE" -cf /tmp/occweb-deploy.tar . # 2. Copy it onto the Docker host, then into the container scp /tmp/occweb-deploy.tar :/tmp/occweb-deploy.tar ssh "docker cp /tmp/occweb-deploy.tar nextcloud-aio-nextcloud:/tmp/occweb-deploy.tar && \ - docker exec nextcloud-aio-nextcloud sh -c 'mkdir -p /var/www/html/custom_apps/occweb && \ - tar -xf /tmp/occweb-deploy.tar -C /var/www/html/custom_apps/occweb && rm /tmp/occweb-deploy.tar'" + docker exec nextcloud-aio-nextcloud sh -c 'mkdir -p /var/www/html/custom_apps/extended_occweb && \ + tar -xf /tmp/occweb-deploy.tar -C /var/www/html/custom_apps/extended_occweb && rm /tmp/occweb-deploy.tar'" # 3. Fix ownership - tar preserves the source uid/gid, not www-data -ssh "docker exec nextcloud-aio-nextcloud chown -R www-data:www-data /var/www/html/custom_apps/occweb" +ssh "docker exec nextcloud-aio-nextcloud chown -R www-data:www-data /var/www/html/custom_apps/extended_occweb" # 4. Fresh install only (skip when updating an already-enabled app): -ssh "docker exec -u www-data nextcloud-aio-nextcloud php occ app:enable occweb" +ssh "docker exec -u www-data nextcloud-aio-nextcloud php occ app:enable extended_occweb" ``` > **Gotcha**: never copy a file into a container with `ssh host "docker exec container bash -c 'cat > file'"` @@ -54,7 +54,7 @@ and Nextcloud puts the whole instance into a "needs upgrade" state until you syn manually: ```bash -ssh "docker exec -u www-data nextcloud-aio-nextcloud php occ config:app:set occweb installed_version --value='X.Y.Z'" +ssh "docker exec -u www-data nextcloud-aio-nextcloud php occ config:app:set extended_occweb installed_version --value='X.Y.Z'" ``` (use the same `X.Y.Z` as the new ``). Verify with `occ status` that @@ -77,8 +77,8 @@ default path) — hence the manual PID lookup. ## Removing the app ```bash -ssh "docker exec -u www-data nextcloud-aio-nextcloud php occ app:disable occweb && \ - docker exec nextcloud-aio-nextcloud rm -rf /var/www/html/custom_apps/occweb" +ssh "docker exec -u www-data nextcloud-aio-nextcloud php occ app:disable extended_occweb && \ + docker exec nextcloud-aio-nextcloud rm -rf /var/www/html/custom_apps/extended_occweb" ``` ## `max-version` policy diff --git a/README.md b/README.md index a6ec0ac..e6d070f 100644 --- a/README.md +++ b/README.md @@ -39,10 +39,13 @@ path and deploy steps differ from the generic instructions below. No build step required (plain PHP + vanilla JS). Clone straight into the target server's `apps/` directory and run the install script: +Nextcloud requires the app's directory name to match its id (`extended_occweb`), so +clone into that name explicitly rather than the repo's own name: + ```bash cd /var/www/nextcloud/apps -git clone https://github.com/dillardblom/occweb.git -bash occweb/install.sh +git clone https://github.com/dillardblom/occweb.git extended_occweb +bash extended_occweb/install.sh ``` `install.sh` removes the dev/CI-only files that don't belong in a running @@ -53,7 +56,7 @@ server user, and runs `occ app:enable`. It assumes Nextcloud lives at values as arguments if that's not the case: ```bash -bash occweb/install.sh /path/to/nextcloud custom-web-user +bash extended_occweb/install.sh /path/to/nextcloud custom-web-user ``` `occ app:enable` takes care of registering the app's version correctly, so @@ -102,7 +105,7 @@ So if your instance is pretty big, commands like `occ files:scan` will time out ## Deploying updates -After pulling/copying new code into `nextcloud/apps/occweb/`, restart PHP so +After pulling/copying new code into `nextcloud/apps/extended_occweb/`, restart PHP so the changes actually take effect. `occ app:disable`/`app:enable` is **not** enough — it does not clear PHP's opcode cache, so a stale, cached version of the code can keep running (routes silently 404ing is a typical symptom). @@ -124,7 +127,7 @@ CLI-upgrade wizard, even though nothing about Nextcloud core actually changed. After bumping the version, sync it manually: ```bash -sudo -u www-data php /var/www/nextcloud/occ config:app:set occweb installed_version --value="X.Y.Z" +sudo -u www-data php /var/www/nextcloud/occ config:app:set extended_occweb installed_version --value="X.Y.Z" ``` (use the same `X.Y.Z` as the new ``), then restart PHP as above. diff --git a/appinfo/info.xml b/appinfo/info.xml index dc7132d..8186cd6 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -1,11 +1,11 @@ - occweb + extended_occweb Extended OCC Web OCC Commands in a web terminal - 0.3.5 + 0.4.0 agpl Dillard Blom OCCWeb @@ -25,7 +25,7 @@ OCCWeb - occweb.occ.index + extended_occweb.occ.index app.svg link diff --git a/install.sh b/install.sh index 49b4c22..cf6f335 100755 --- a/install.sh +++ b/install.sh @@ -1,10 +1,11 @@ #!/usr/bin/env bash # -# Post-clone install script for occweb. +# Post-clone install script for occweb (Nextcloud app id: extended_occweb). # -# Usage (from nextcloud/apps/): -# git clone https://github.com/dillardblom/occweb.git -# bash occweb/install.sh [nextcloud-root] [web-user] +# Usage (from nextcloud/apps/) - clone into "extended_occweb", not the repo's +# own name, since Nextcloud requires the app directory to match its id: +# git clone https://github.com/dillardblom/occweb.git extended_occweb +# bash extended_occweb/install.sh [nextcloud-root] [web-user] # # Defaults: nextcloud-root=/var/www/nextcloud, web-user=www-data # diff --git a/js/index.js b/js/index.js index a7ce99c..f8c80c4 100644 --- a/js/index.js +++ b/js/index.js @@ -12,7 +12,7 @@ var html = $('html'); html.scrollTop(html.prop('scrollHeight')); } - var baseUrl = OC.generateUrl('/apps/occweb'); + var baseUrl = OC.generateUrl('/apps/extended_occweb'); // Current terminal mode: 'occ' (regular occ commands) or 'sql' // (running arbitrary SQL queries via /db/query). diff --git a/lib/Controller/DbController.php b/lib/Controller/DbController.php index 31afa38..e558344 100644 --- a/lib/Controller/DbController.php +++ b/lib/Controller/DbController.php @@ -189,8 +189,8 @@ class DbController extends Controller // Audit: log the fact that execution was attempted BEFORE any checks, // so blocked/rejected queries are recorded in the log too, not just // the ones that succeeded. - $this->logger->warning('[occweb] SQL submitted by {user}: {sql}', [ - 'app' => 'occweb', + $this->logger->warning('[extended_occweb] SQL submitted by {user}: {sql}', [ + 'app' => 'extended_occweb', 'user' => $user->getUID(), 'sql' => $sql, ]); @@ -207,8 +207,8 @@ class DbController extends Controller foreach ($queries as $query) { $forbidden = $this->findForbiddenConstruct($query); if ($forbidden !== null) { - $this->logger->error('[occweb] Blocked forbidden construct ({construct}) from {user}: {sql}', [ - 'app' => 'occweb', + $this->logger->error('[extended_occweb] Blocked forbidden construct ({construct}) from {user}: {sql}', [ + 'app' => 'extended_occweb', 'construct' => $forbidden, 'user' => $user->getUID(), 'sql' => $sql, @@ -277,8 +277,8 @@ class DbController extends Controller $this->db->beginTransaction(); $transactionStarted = true; } catch (\Exception $e) { - $this->logger->warning('[occweb] beginTransaction() failed, proceeding without an explicit transaction: {error}', [ - 'app' => 'occweb', + $this->logger->warning('[extended_occweb] beginTransaction() failed, proceeding without an explicit transaction: {error}', [ + 'app' => 'extended_occweb', 'error' => $e->getMessage(), ]); } @@ -353,8 +353,8 @@ class DbController extends Controller // permanently applied — we deliberately do NOT set // rolledBack to true, since that would be untrue. $rollbackFailed = true; - $this->logger->warning('[occweb] rollBack() failed after an error — earlier statements in this batch may already be permanently applied: {error}', [ - 'app' => 'occweb', + $this->logger->warning('[extended_occweb] rollBack() failed after an error — earlier statements in this batch may already be permanently applied: {error}', [ + 'app' => 'extended_occweb', 'error' => $rollbackError->getMessage(), ]); } @@ -371,8 +371,8 @@ class DbController extends Controller // a DDL statement on MySQL/MariaDB) — the effects are // already saved, this isn't an error in executing the batch // itself. - $this->logger->info('[occweb] commit() had nothing to commit (likely auto-committed by a DDL statement): {error}', [ - 'app' => 'occweb', + $this->logger->info('[extended_occweb] commit() had nothing to commit (likely auto-committed by a DDL statement): {error}', [ + 'app' => 'extended_occweb', 'error' => $e->getMessage(), ]); } diff --git a/lib/Controller/OccController.php b/lib/Controller/OccController.php index fe4c169..1255604 100644 --- a/lib/Controller/OccController.php +++ b/lib/Controller/OccController.php @@ -70,7 +70,7 @@ class OccController extends Controller public function index() { if ($err = $this->requireAdmin()) return $err; - return new TemplateResponse('occweb', 'index'); + return new TemplateResponse('extended_occweb', 'index'); } /** diff --git a/templates/index.php b/templates/index.php index 3b06ca7..ad31f1b 100644 --- a/templates/index.php +++ b/templates/index.php @@ -3,11 +3,11 @@ // reliably present on NC34+ (see e.g. serverinfo needing to bundle its own) - // term.js (jquery.terminal) and index.js both require jQuery to be loaded // first, so ship and load our own copy rather than relying on core. -script('occweb', 'jquery'); -script('occweb', 'index'); -script('occweb', 'term'); -script('occweb', 'unix_formatting'); -style('occweb', 'style'); +script('extended_occweb', 'jquery'); +script('extended_occweb', 'index'); +script('extended_occweb', 'term'); +script('extended_occweb', 'unix_formatting'); +style('extended_occweb', 'style'); ?>