diff --git a/.github/workflows/versions.yml b/.github/workflows/versions.yml new file mode 100644 index 00000000..5ac0c03e --- /dev/null +++ b/.github/workflows/versions.yml @@ -0,0 +1,436 @@ +name: versions + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + source_abi: + runs-on: ubuntu-22.04 + outputs: + extension_version: ${{ steps.build_extension.outputs.extension_version }} + abi_version: ${{ steps.build_extension.outputs.abi_version }} + alternate_abi_version: ${{ steps.build_extension.outputs.alternate_abi_version }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + fetch-tags: true + - uses: hendrikmuhs/ccache-action@v1.2 + with: + max-size: 2G + key: ${{ github.job }} + - name: Build + id: build_extension + run: | + gem install --no-document --user-install nokogiri + export COMMITS_SINCE_LAST_TAG=$(git describe --tags --always --long | awk -F '-' '{print $2}') + EXTENSION_VERSION=$(ruby -e 'print [ARGF.read[/PHP_COUCHBASE_VERSION "(\d+\.\d+\.\d+)"/, 1], ENV["COMMITS_SINCE_LAST_TAG"].to_i > 0 ? ENV["COMMITS_SINCE_LAST_TAG"] : nil].compact.join(".")' src/php_couchbase.hxx) + echo "extension_version=${EXTENSION_VERSION}" >> "$GITHUB_OUTPUT" + ABI_VERSION=$(ruby -e 'print ARGF.read[/PHP_COUCHBASE_VERSION "(\d+\.\d+\.\d+)"/, 1].gsub(".", "_")' src/php_couchbase.hxx) + ALTERNATE_ABI_VERSION=$(ruby -e 'print ARGF.read[/PHP_COUCHBASE_VERSION "(\d+\.\d+\.\d+)"/, 1].gsub(".", "_").succ' src/php_couchbase.hxx) + echo "abi_version=${ABI_VERSION}" >> "$GITHUB_OUTPUT" + echo "alternate_abi_version=${ALTERNATE_ABI_VERSION}" >> "$GITHUB_OUTPUT" + export BUILD_NUMBER="${COMMITS_SINCE_LAST_TAG}" + ruby ./bin/package.rb + - uses: actions/upload-artifact@v4 + with: + name: couchbase-${{ steps.build_extension.outputs.extension_version }} + path: | + couchbase-*.tgz + - uses: actions/upload-artifact@v4 + with: + retention-days: 1 + name: scripts-${{ steps.build_extension.outputs.extension_version }} + path: | + bin/**/* + 90-couchbase.ini + phpcs.xml + - uses: actions/upload-artifact@v4 + with: + retention-days: 1 + name: tests-${{ steps.build_extension.outputs.extension_version }} + path: | + tests/**/* + abi_linux_build: + needs: source_abi + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + version: + - unversioned + - ${{ needs.source_abi.outputs.abi_version }} + - ${{ needs.source_abi.outputs.alternate_abi_version }} + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + extensions: json, mbstring, intl + env: + phpts: nts + - uses: actions/download-artifact@v4 + with: + name: couchbase-${{ needs.source_abi.outputs.extension_version }} + - uses: actions/download-artifact@v4 + with: + name: scripts-${{ needs.source_abi.outputs.extension_version }} + - uses: hendrikmuhs/ccache-action@v1.2 + with: + max-size: 2G + key: ${{ github.job }}-${{ matrix.version }} + - name: Set env variable + run: | + if [ "${{ matrix.version }}" != "unversioned" ]; then + echo "CB_ABI_VERSION=${{ matrix.version }}" >> $GITHUB_ENV + else + echo "Building unversioned extension" + fi + - name: Build + run: | + echo "Building versioned extension: ${CB_ABI_VERSION}" + pecl bundle couchbase-${{ needs.source_abi.outputs.extension_version }}.tgz + ( + cd couchbase + phpize + ./configure --enable-couchbase + mkdir target + make INSTALL_ROOT="$(realpath target)" install + ) + DIST_NAME=couchbase-${{ matrix.version }}-linux-x86_64 + mkdir ${DIST_NAME} + cp -av couchbase/LICENSE 90-couchbase.ini couchbase/Couchbase couchbase/GPBMetadata ${DIST_NAME}/ + find couchbase/target -name couchbase.so -exec cp -v {} ${DIST_NAME}/ \; + strip --strip-all ${DIST_NAME}/couchbase.so + if [ -n "${CB_ABI_VERSION}" ]; then + echo "Renaming so file to couchbase_${CB_ABI_VERSION}.so" + mv ${DIST_NAME}/couchbase.so ${DIST_NAME}/couchbase_${CB_ABI_VERSION}.so + else + echo "CB_ABI_VERSION not set, keeping couchbase.so" + fi + tar cv ${DIST_NAME}/ | gzip -9 > ${DIST_NAME}.tgz + - uses: actions/upload-artifact@v4 + with: + name: couchbase-${{ matrix.version }}-linux-x86_64 + path: | + couchbase-*-linux-x86_64.tgz + abi_linux_x86_64_test: + needs: + - source_abi + - abi_linux_build + runs-on: ubuntu-22.04 + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + extensions: json, mbstring, intl + env: + phpts: nts + - uses: actions/download-artifact@v4 + with: + name: scripts-${{ needs.source_abi.outputs.extension_version }} + - uses: actions/download-artifact@v4 + with: + path: tests + name: tests-${{ needs.source_abi.outputs.extension_version }} + - uses: actions/download-artifact@v4 + with: + name: couchbase-${{ needs.source_abi.outputs.abi_version }}-linux-x86_64 + - uses: actions/download-artifact@v4 + with: + name: couchbase-${{ needs.source_abi.outputs.alternate_abi_version }}-linux-x86_64 + - uses: actions/download-artifact@v4 + with: + name: couchbase-unversioned-linux-x86_64 + - name: Test + env: + CB_ABI_VERSION: ${{ needs.source_abi.outputs.abi_version }} + run: | + tar xf couchbase-unversioned-linux-x86_64.tgz + tar xf couchbase-${{ needs.source_abi.outputs.abi_version }}-linux-x86_64.tgz + tar xf couchbase-${{ needs.source_abi.outputs.alternate_abi_version }}-linux-x86_64.tgz + TEST_ABI=both ruby ./bin/test.rb -v ${{ needs.source_abi.outputs.abi_version }} -v ${{ needs.source_abi.outputs.alternate_abi_version }} -v unversioned + TEST_ABI=versioned ruby ./bin/test.rb -v ${{ needs.source_abi.outputs.abi_version }} + + ruby -e ' + file_paths = [ + "couchbase-unversioned-linux-x86_64/Couchbase/ExtensionNamespaceResolver.php", + "couchbase-${{ needs.source_abi.outputs.abi_version }}-linux-x86_64/Couchbase/ExtensionNamespaceResolver.php", + "couchbase-${{ needs.source_abi.outputs.alternate_abi_version }}-linux-x86_64/Couchbase/ExtensionNamespaceResolver.php" + ] + file_paths.each do |file_name| + text = File.read(file_name) + new_contents = text.gsub("${{ needs.source_abi.outputs.abi_version }}", "${{ needs.source_abi.outputs.alternate_abi_version }}") + File.open(file_name, "w") { |file| file.puts new_contents } + end + ' + TEST_ABI=both ruby ./bin/test.rb -v ${{ needs.source_abi.outputs.abi_version }} -v ${{ needs.source_abi.outputs.alternate_abi_version }} -v unversioned + TEST_ABI=versioned ruby ./bin/test.rb -v ${{ needs.source_abi.outputs.alternate_abi_version }} + build_macos_x86_64: + needs: source_abi + runs-on: macos-13 + strategy: + fail-fast: false + matrix: + version: + - unversioned + - ${{ needs.source_abi.outputs.abi_version }} + - ${{ needs.source_abi.outputs.alternate_abi_version }} + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + # https://github.com/shivammathur/icu-intl#icu4c-builds + extensions: json, mbstring, intl-74.1 + env: + phpts: nts + - uses: actions/download-artifact@v4 + with: + name: couchbase-${{ needs.source_abi.outputs.extension_version }} + - uses: actions/download-artifact@v4 + with: + name: scripts-${{ needs.source_abi.outputs.extension_version }} + - uses: hendrikmuhs/ccache-action@v1.2 + with: + max-size: 2G + key: ${{ github.job }}-${{ matrix.version }} + - name: Set env variable + run: | + if [ "${{ matrix.version }}" != "unversioned" ]; then + echo "CB_ABI_VERSION=${{ matrix.version }}" >> $GITHUB_ENV + else + echo "Building unversioned extension" + fi + - name: Build + run: | + echo "Building versioned extension: ${CB_ABI_VERSION}" + pecl bundle couchbase-${{ needs.source_abi.outputs.extension_version }}.tgz + ( + cd couchbase + phpize + ./configure --enable-couchbase + mkdir target + make INSTALL_ROOT="$(realpath target)" install + ) + DIST_NAME=couchbase-${{ matrix.version }}-macos-x86_64 + mkdir ${DIST_NAME} + cp -av couchbase/LICENSE 90-couchbase.ini couchbase/Couchbase couchbase/GPBMetadata ${DIST_NAME}/ + find couchbase/target -name couchbase.so -exec cp -v {} ${DIST_NAME}/ \; + strip ${DIST_NAME}/couchbase.so 2>/dev/null || true + if [ -n "${CB_ABI_VERSION}" ]; then + echo "Renaming so file to couchbase_${CB_ABI_VERSION}.so" + mv ${DIST_NAME}/couchbase.so ${DIST_NAME}/couchbase_${CB_ABI_VERSION}.so + else + echo "CB_ABI_VERSION not set, keeping couchbase.so" + fi + tar cv ${DIST_NAME}/ | gzip -9 > ${DIST_NAME}.tgz + - uses: actions/upload-artifact@v4 + with: + name: couchbase-${{ matrix.version }}-macos-x86_64 + path: | + couchbase-*-macos-x86_64.tgz + macos_x86_64_test: + needs: + - source_abi + - build_macos_x86_64 + runs-on: macos-13 + strategy: + fail-fast: false + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + # https://github.com/shivammathur/icu-intl#icu4c-builds + extensions: json, mbstring, intl-74.1 + env: + phpts: nts + - uses: actions/download-artifact@v4 + with: + name: scripts-${{ needs.source_abi.outputs.extension_version }} + - uses: actions/download-artifact@v4 + with: + path: tests + name: tests-${{ needs.source_abi.outputs.extension_version }} + - uses: actions/download-artifact@v4 + with: + name: couchbase-${{ needs.source_abi.outputs.abi_version }}-macos-x86_64 + - uses: actions/download-artifact@v4 + with: + name: couchbase-${{ needs.source_abi.outputs.alternate_abi_version }}-macos-x86_64 + - uses: actions/download-artifact@v4 + with: + name: couchbase-${{ needs.source_abi.outputs.abi_version }}-macos-x86_64 + - uses: actions/download-artifact@v4 + with: + name: couchbase-unversioned-macos-x86_64 + - name: Test + env: + CB_ABI_VERSION: ${{ needs.source_abi.outputs.abi_version }} + run: | + tar xf couchbase-unversioned-macos-x86_64.tgz + tar xf couchbase-${{ needs.source_abi.outputs.abi_version }}-macos-x86_64.tgz + tar xf couchbase-${{ needs.source_abi.outputs.alternate_abi_version }}-macos-x86_64.tgz + TEST_ABI=both CB_PHP_EXECUTABLE=$(which php) ruby ./bin/test.rb -v ${{ needs.source_abi.outputs.abi_version }} -v ${{ needs.source_abi.outputs.alternate_abi_version }} -v unversioned + TEST_ABI=versioned CB_PHP_EXECUTABLE=$(which php) ruby ./bin/test.rb -v ${{ needs.source_abi.outputs.abi_version }} + ruby -e ' + file_paths = [ + "couchbase-unversioned-macos-x86_64/Couchbase/ExtensionNamespaceResolver.php", + "couchbase-${{ needs.source_abi.outputs.abi_version }}-macos-x86_64/Couchbase/ExtensionNamespaceResolver.php", + "couchbase-${{ needs.source_abi.outputs.alternate_abi_version }}-macos-x86_64/Couchbase/ExtensionNamespaceResolver.php" + ] + file_paths.each do |file_name| + text = File.read(file_name) + new_contents = text.gsub("${{ needs.source_abi.outputs.abi_version }}", "${{ needs.source_abi.outputs.alternate_abi_version }}") + File.open(file_name, "w") { |file| file.puts new_contents } + end + ' + TEST_ABI=both CB_PHP_EXECUTABLE=$(which php) ruby ./bin/test.rb -v ${{ needs.source_abi.outputs.abi_version }} -v ${{ needs.source_abi.outputs.alternate_abi_version }} -v unversioned + TEST_ABI=versioned CB_PHP_EXECUTABLE=$(which php) ruby ./bin/test.rb -v ${{ needs.source_abi.outputs.alternate_abi_version }} + + build_windows: + needs: source_abi + runs-on: windows-2019 + strategy: + fail-fast: false + matrix: + version: + - unversioned + - ${{ needs.source_abi.outputs.abi_version }} + - ${{ needs.source_abi.outputs.alternate_abi_version }} + steps: + - name: Install dependencies + shell: cmd + run: | + # winget install Git.Git + # winget install Kitware.CMake + # winget install NASM.NASM + choco install nasm + git clone --no-progress https://github.com/php/php-sdk-binary-tools.git c:\php\php-sdk + git clone --no-progress --depth 1 --branch php-8.3.4 https://github.com/php/php-src.git c:\php\php-src + - uses: actions/download-artifact@v4 + with: + path: c:\php + name: couchbase-${{ needs.source_abi.outputs.extension_version }} + - uses: actions/download-artifact@v4 + with: + path: c:\php + name: scripts-${{ needs.source_abi.outputs.extension_version }} + - name: Set env variable + shell: pwsh + run: | + if ("${{ matrix.version }}" -ne "unversioned") { + echo "CB_ABI_VERSION=${{ matrix.version }}" >> $env:GITHUB_ENV + } else { + Write-Output "Building unversioned extension" + } + - name: Build + working-directory: c:\php + shell: cmd + run: | + 7z x couchbase-${{ needs.source_abi.outputs.extension_version }}.tgz -so | 7z x -aoa -si -ttar + cd c:\php\php-src + echo call buildconf.bat --add-modules-dir=c:\php > task.bat + echo call configure.bat --disable-all --enable-cli --disable-zts --enable-couchbase >> task.bat + echo nmake >> task.bat + dir + call c:\php\php-sdk\phpsdk-vs16-x64.bat -t task.bat + dir + if defined CB_ABI_VERSION ( + echo Renaming so file to php_couchbase_%CB_ABI_VERSION%.dll + move "C:\php\php-src\x64\Release\php_couchbase.dll" "C:\php\php-src\x64\Release\php_couchbase_%CB_ABI_VERSION%.dll" + ) else ( + echo CB_ABI_VERSION not set, keeping php_couchbase.dll + ) + exit /b %ERRORLEVEL% + - name: Package + id: package + working-directory: c:\php + run: | + $PhpVersion = ("8.3.4" -split '\.')[0..1] -join '.' + Add-Content -Path $env:GITHUB_OUTPUT -Value "php_version=$PhpVersion" + $SourceDirectory = (Get-ChildItem -Path "c:\php" -Directory "couchbase-*" | Select-Object -First 1).FullName + $DistName = "couchbase-${{ matrix.version }}-windows-x64" + New-Item -ItemType Directory -Path $DistName | Out-Null + $FilesToCopy = Get-ChildItem -Path . -Filter "couchbase-*" -Include LICENSE,"Couchbase","GPBMetadata" + Copy-Item -Path 90-couchbase.ini -Destination $DistName -Force + Copy-Item -Path "${SourceDirectory}\LICENSE" -Destination $DistName -Force + Copy-Item -Path "${SourceDirectory}\Couchbase" -Destination $DistName -Force -Recurse + Copy-Item -Path "${SourceDirectory}\GPBMetadata" -Destination $DistName -Force -Recurse + $FilesToCopy = Get-ChildItem -Path "C:\php\php-src\x64\Release" -Filter "php_couchbase*" + foreach ($File in $FilesToCopy) { + Write-Host "Copying file: $($File.FullName)" + Copy-Item -Path $File.FullName -Destination $DistName -Force + } + $ZipArchive = $DistName + ".zip" + Write-Host "Compressing $DistName directory into $ZipArchive" + Compress-Archive -Path $DistName -DestinationPath $ZipArchive -CompressionLevel Optimal + - uses: actions/upload-artifact@v4 + with: + name: couchbase-${{ matrix.version }}-windows-x64 + path: | + c:\php\couchbase-*-windows-x64.zip + + mock_windows: + needs: + - source_abi + - build_windows + runs-on: windows-2019 + strategy: + fail-fast: false + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.3 + extensions: json, mbstring, intl, sockets + env: + phpts: nts + - uses: actions/download-artifact@v4 + with: + name: couchbase-${{ needs.source_abi.outputs.extension_version }} + - uses: actions/download-artifact@v4 + with: + name: scripts-${{ needs.source_abi.outputs.extension_version }} + - uses: actions/download-artifact@v4 + with: + path: tests + name: tests-${{ needs.source_abi.outputs.extension_version }} + - uses: actions/download-artifact@v4 + with: + name: couchbase-unversioned-windows-x64 + - uses: actions/download-artifact@v4 + with: + name: couchbase-${{ needs.source_abi.outputs.abi_version }}-windows-x64 + - uses: actions/download-artifact@v4 + with: + name: couchbase-${{ needs.source_abi.outputs.alternate_abi_version }}-windows-x64 + - name: Test + timeout-minutes: 60 + run: | + Expand-Archive -Path couchbase-unversioned-windows-x64.zip + Expand-Archive -Path couchbase-${{ needs.source_abi.outputs.abi_version }}-windows-x64.zip + Expand-Archive -Path couchbase-${{ needs.source_abi.outputs.alternate_abi_version }}-windows-x64.zip + $env:TEST_ABI='both'; ruby ./bin/test.rb -v ${{ needs.source_abi.outputs.abi_version }} -v ${{ needs.source_abi.outputs.alternate_abi_version }} -v unversioned + $env:TEST_ABI='versioned'; ruby ./bin/test.rb -v ${{ needs.source_abi.outputs.abi_version }} + + ruby -e ' + file_paths = [ + "couchbase-unversioned-windows-x64/couchbase-unversioned-windows-x64/Couchbase/ExtensionNamespaceResolver.php", + "couchbase-${{ needs.source_abi.outputs.abi_version }}-windows-x64/couchbase-${{ needs.source_abi.outputs.abi_version }}-windows-x64/Couchbase/ExtensionNamespaceResolver.php", + "couchbase-${{ needs.source_abi.outputs.alternate_abi_version }}-windows-x64/couchbase-${{ needs.source_abi.outputs.alternate_abi_version }}-windows-x64/Couchbase/ExtensionNamespaceResolver.php" + ] + file_paths.each do |file_name| + text = File.read(file_name) + new_contents = text.gsub("${{ needs.source_abi.outputs.abi_version }}", "${{ needs.source_abi.outputs.alternate_abi_version }}") + File.open(file_name, "w") { |file| file.puts new_contents } + end + ' + $env:TEST_ABI='both'; ruby ./bin/test.rb -v ${{ needs.source_abi.outputs.abi_version }} -v ${{ needs.source_abi.outputs.alternate_abi_version }} -v unversioned + $env:TEST_ABI='versioned'; ruby ./bin/test.rb -v ${{ needs.source_abi.outputs.alternate_abi_version }} diff --git a/Couchbase/BinaryCollection.php b/Couchbase/BinaryCollection.php index 0e532821..a166fdb3 100644 --- a/Couchbase/BinaryCollection.php +++ b/Couchbase/BinaryCollection.php @@ -80,7 +80,8 @@ public function name(): string */ public function append(string $id, string $value, ?AppendOptions $options = null): MutationResult { - $response = Extension\documentAppend( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentAppend'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, @@ -107,7 +108,8 @@ public function append(string $id, string $value, ?AppendOptions $options = null */ public function prepend(string $id, string $value, ?PrependOptions $options = null): MutationResult { - $response = Extension\documentPrepend( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentPrepend'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, @@ -133,7 +135,8 @@ public function prepend(string $id, string $value, ?PrependOptions $options = nu */ public function increment(string $id, ?IncrementOptions $options = null): CounterResult { - $response = Extension\documentIncrement( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentIncrement'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, @@ -158,7 +161,8 @@ public function increment(string $id, ?IncrementOptions $options = null): Counte */ public function decrement(string $id, ?DecrementOptions $options = null): CounterResult { - $response = Extension\documentDecrement( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentDecrement'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, diff --git a/Couchbase/Bucket.php b/Couchbase/Bucket.php index 2d13f3fa..54f8ead3 100644 --- a/Couchbase/Bucket.php +++ b/Couchbase/Bucket.php @@ -50,7 +50,8 @@ public function __construct(string $name, $core) { $this->name = $name; $this->core = $core; - Extension\openBucket($this->core, $this->name); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\openBucket'; + $function($this->core, $this->name); } /** @@ -128,7 +129,9 @@ public function viewQuery(string $designDoc, string $viewName, ?ViewOptions $opt $opts = ViewOptions::export($options); $namespace = $opts["namespace"]; - $result = Extension\viewQuery($this->core, $this->name, $designDoc, $viewName, $namespace, $opts); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\viewQuery'; + + $result = $function($this->core, $this->name, $designDoc, $viewName, $namespace, $opts); return new ViewResult($result); } @@ -183,7 +186,9 @@ public function ping($services = null, $reportId = null) if ($reportId != null) { $options['reportId'] = $reportId; } - return Extension\ping($this->core, $options); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\ping'; + + return $function($this->core, $options); } /** @@ -200,6 +205,7 @@ public function diagnostics(?string $reportId = null) if ($reportId == null) { $reportId = uniqid(); } - return Extension\diagnostics($this->core, $reportId); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\diagnostics'; + return $function($this->core, $reportId); } } diff --git a/Couchbase/Cluster.php b/Couchbase/Cluster.php index 06ed0f06..702d46c8 100644 --- a/Couchbase/Cluster.php +++ b/Couchbase/Cluster.php @@ -59,8 +59,10 @@ public function __construct(string $connectionString, ClusterOptions $options) ) { throw new InvalidArgumentException("Please use Cluster::connect() to connect to CNG."); } - $this->connectionHash = hash("sha256", sprintf("--%s--%s--", $connectionString, $options->authenticatorHash())); - $this->core = Extension\createConnection($this->connectionHash, $connectionString, $options->export()); + ExtensionNamespaceResolver::defineExtensionNamespace(); + $this->connectionHash = hash("sha256", sprintf("--%s--%s--%s--", $connectionString, $options->authenticatorHash(), COUCHBASE_EXTENSION_NAMESPACE)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\createConnection'; + $this->core = $function($this->connectionHash, $connectionString, $options->export()); $this->options = $options; } @@ -136,7 +138,8 @@ function (string $connectionString, ClusterOptions $options) { */ public static function notifyFork(string $event) { - return Extension\notifyFork($event); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\notifyFork'; + return $function($event); } /** @@ -167,7 +170,8 @@ public function bucket(string $name): BucketInterface */ public function query(string $statement, ?QueryOptions $options = null): QueryResult { - $result = Extension\query($this->core, $statement, QueryOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\query'; + $result = $function($this->core, $statement, QueryOptions::export($options)); return new QueryResult($result, QueryOptions::getTranscoder($options)); } @@ -186,7 +190,8 @@ public function query(string $statement, ?QueryOptions $options = null): QueryRe */ public function analyticsQuery(string $statement, ?AnalyticsOptions $options = null): AnalyticsResult { - $result = Extension\analyticsQuery($this->core, $statement, AnalyticsOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsQuery'; + $result = $function($this->core, $statement, AnalyticsOptions::export($options)); return new AnalyticsResult($result, AnalyticsOptions::getTranscoder($options)); } @@ -204,7 +209,8 @@ public function analyticsQuery(string $statement, ?AnalyticsOptions $options = n */ public function searchQuery(string $indexName, SearchQuery $query, ?SearchOptions $options = null): SearchResult { - $result = Extension\searchQuery($this->core, $indexName, json_encode($query), SearchOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\searchQuery'; + $result = $function($this->core, $indexName, json_encode($query), SearchOptions::export($options)); return new SearchResult($result); } @@ -230,12 +236,14 @@ public function search(string $indexName, SearchRequest $request, ?SearchOptions $query = $exportedRequest['searchQuery']; if (!$exportedRequest['vectorSearch']) { - $result = Extension\searchQuery($this->core, $indexName, json_encode($query), $exportedOptions); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\searchQuery'; + $result = $function($this->core, $indexName, json_encode($query), $exportedOptions); return new SearchResult($result); } $vectorSearch = $exportedRequest['vectorSearch']; - $result = Extension\vectorSearch($this->core, $indexName, json_encode($query), json_encode($vectorSearch), $exportedOptions, VectorSearchOptions::export($vectorSearch->options())); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\vectorSearch'; + $result = $function($this->core, $indexName, json_encode($query), json_encode($vectorSearch), $exportedOptions, VectorSearchOptions::export($vectorSearch->options())); return new SearchResult($result); } @@ -318,7 +326,8 @@ public function ping($services = null, $reportId = null) if ($reportId != null) { $options['reportId'] = $reportId; } - return Extension\ping($this->core, $options); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\ping'; + return $function($this->core, $options); } /** @@ -334,7 +343,8 @@ public function diagnostics(?string $reportId = null) if ($reportId == null) { $reportId = uniqid(); } - return Extension\diagnostics($this->core, $reportId); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\diagnostics'; + return $function($this->core, $reportId); } /** @@ -359,7 +369,8 @@ public function transactions(?TransactionsConfiguration $config = null): Transac */ public function version(string $bucketName): ?string { - return Extension\clusterVersion($this->core, $bucketName); + $function = COUCHBASE_EXTENSION_NAMESPACE . "\\clusterVersion"; + return $function($this->core, $bucketName); } /** @@ -371,7 +382,8 @@ public function version(string $bucketName): ?string */ public function replicasConfiguredFor(string $bucketName): bool { - return Extension\replicasConfiguredForBucket($this->core, $bucketName); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\replicasConfiguredForBucket'; + return $function($this->core, $bucketName); } /** diff --git a/Couchbase/Collection.php b/Couchbase/Collection.php index 5a5c070f..9a7989d2 100644 --- a/Couchbase/Collection.php +++ b/Couchbase/Collection.php @@ -115,8 +115,8 @@ public function name(): string */ public function get(string $id, ?GetOptions $options = null): GetResult { - $response = Extension\documentGet( - $this->core, + $function = COUCHBASE_EXTENSION_NAMESPACE . "\\documentGet"; + $response = $function($this->core, $this->bucketName, $this->scopeName, $this->name, @@ -139,7 +139,8 @@ public function get(string $id, ?GetOptions $options = null): GetResult */ public function exists(string $id, ?ExistsOptions $options = null): ExistsResult { - $response = Extension\documentExists( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentExists'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, @@ -166,7 +167,8 @@ public function exists(string $id, ?ExistsOptions $options = null): ExistsResult */ public function getAndLock(string $id, int $lockTimeSeconds, ?GetAndLockOptions $options = null): GetResult { - $response = Extension\documentGetAndLock( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentGetAndLock'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, @@ -198,7 +200,8 @@ public function getAndTouch(string $id, $expiry, ?GetAndTouchOptions $options = } else { $expirySeconds = (int)$expiry; } - $response = Extension\documentGetAndTouch( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentGetAndTouch'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, @@ -225,7 +228,8 @@ public function getAndTouch(string $id, $expiry, ?GetAndTouchOptions $options = */ public function getAnyReplica(string $id, ?GetAnyReplicaOptions $options = null): GetReplicaResult { - $response = Extension\documentGetAnyReplica( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentGetAnyReplica'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, @@ -250,7 +254,8 @@ public function getAnyReplica(string $id, ?GetAnyReplicaOptions $options = null) */ public function getAllReplicas(string $id, ?GetAllReplicasOptions $options = null): array { - $responses = Extension\documentGetAllReplicas( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentGetAllReplicas'; + $responses = $function( $this->core, $this->bucketName, $this->scopeName, @@ -281,7 +286,8 @@ function (array $response) use ($options) { public function upsert(string $id, $value, ?UpsertOptions $options = null): MutationResult { $encoded = UpsertOptions::encodeDocument($options, $value); - $response = Extension\documentUpsert( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentUpsert'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, @@ -310,7 +316,8 @@ public function upsert(string $id, $value, ?UpsertOptions $options = null): Muta public function insert(string $id, $value, ?InsertOptions $options = null): MutationResult { $encoded = InsertOptions::encodeDocument($options, $value); - $response = Extension\documentInsert( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentInsert'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, @@ -340,7 +347,8 @@ public function insert(string $id, $value, ?InsertOptions $options = null): Muta public function replace(string $id, $value, ?ReplaceOptions $options = null): MutationResult { $encoded = ReplaceOptions::encodeDocument($options, $value); - $response = Extension\documentReplace( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentReplace'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, @@ -368,7 +376,8 @@ public function replace(string $id, $value, ?ReplaceOptions $options = null): Mu */ public function remove(string $id, ?RemoveOptions $options = null): MutationResult { - $response = Extension\documentRemove( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentRemove'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, @@ -396,7 +405,8 @@ public function remove(string $id, ?RemoveOptions $options = null): MutationResu */ public function unlock(string $id, string $cas, ?UnlockOptions $options = null): Result { - $response = Extension\documentUnlock( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentUnlock'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, @@ -428,7 +438,8 @@ public function touch(string $id, $expiry, ?TouchOptions $options = null): Mutat } else { $expirySeconds = (int)$expiry; } - $response = Extension\documentTouch( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentTouch'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, @@ -464,7 +475,8 @@ function (LookupInSpec $item) { if ($options != null && $options->needToFetchExpiry()) { $encoded[] = ['opcode' => 'get', 'isXattr' => true, 'path' => LookupInMacro::EXPIRY_TIME]; } - $response = Extension\documentLookupIn( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentLookupIn'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, @@ -500,7 +512,8 @@ function (LookupInSpec $item) { if ($options != null && $options->needToFetchExpiry()) { $encoded[] = ['opcode' => 'get', 'isXattr' => true, 'path' => LookupInMacro::EXPIRY_TIME]; } - $response = Extension\documentLookupInAnyReplica( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentLookupInAnyReplica'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, @@ -537,7 +550,8 @@ function (LookupInSpec $item) { if ($options != null && $options->needToFetchExpiry()) { $encoded[] = ['opcode' => 'get', 'isXattr' => true, 'path' => LookupInMacro::EXPIRY_TIME]; } - $responses = Extension\documentLookupInAllReplicas( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentLookupInAllReplicas'; + $responses = $function( $this->core, $this->bucketName, $this->scopeName, @@ -576,7 +590,8 @@ function (MutateInSpec $item) use ($options) { }, $specs ); - $response = Extension\documentMutateIn( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentMutateIn'; + $response = $function( $this->core, $this->bucketName, $this->scopeName, @@ -600,7 +615,8 @@ function (MutateInSpec $item) use ($options) { */ public function getMulti(array $ids, ?GetOptions $options = null): array { - $responses = Extension\documentGetMulti( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentGetMulti'; + $responses = $function( $this->core, $this->bucketName, $this->scopeName, @@ -666,7 +682,8 @@ public function scan(ScanType $scanType, ?ScanOptions $options = null): ScanResu */ public function removeMulti(array $entries, ?RemoveOptions $options = null): array { - $responses = Extension\documentRemoveMulti( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentRemoveMulti'; + $responses = $function( $this->core, $this->bucketName, $this->scopeName, @@ -712,7 +729,8 @@ function (array $entry) use ($options) { }, $entries ); - $responses = Extension\documentUpsertMulti( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentUpsertMulti'; + $responses = $function( $this->core, $this->bucketName, $this->scopeName, diff --git a/Couchbase/ExtensionNamespaceResolver.php b/Couchbase/ExtensionNamespaceResolver.php new file mode 100644 index 00000000..5f09a07a --- /dev/null +++ b/Couchbase/ExtensionNamespaceResolver.php @@ -0,0 +1,48 @@ +core, $dataverseName, CreateAnalyticsDataverseOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsDataverseCreate'; + $function($this->core, $dataverseName, CreateAnalyticsDataverseOptions::export($options)); } /** @@ -62,7 +63,8 @@ public function createDataverse(string $dataverseName, ?CreateAnalyticsDataverse */ public function dropDataverse(string $dataverseName, ?DropAnalyticsDataverseOptions $options = null): void { - Extension\analyticsDataverseDrop($this->core, $dataverseName, DropAnalyticsDataverseOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsDataverseDrop'; + $function($this->core, $dataverseName, DropAnalyticsDataverseOptions::export($options)); } /** @@ -76,7 +78,8 @@ public function dropDataverse(string $dataverseName, ?DropAnalyticsDataverseOpti */ public function createDataset(string $datasetName, string $bucketName, ?CreateAnalyticsDatasetOptions $options = null): void { - Extension\analyticsDatasetCreate($this->core, $datasetName, $bucketName, CreateAnalyticsDatasetOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsDatasetCreate'; + $function($this->core, $datasetName, $bucketName, CreateAnalyticsDatasetOptions::export($options)); } /** @@ -89,7 +92,8 @@ public function createDataset(string $datasetName, string $bucketName, ?CreateAn */ public function dropDataset(string $datasetName, ?DropAnalyticsDatasetOptions $options = null): void { - Extension\analyticsDatasetDrop($this->core, $datasetName, DropAnalyticsDatasetOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsDatasetDrop'; + $function($this->core, $datasetName, DropAnalyticsDatasetOptions::export($options)); } /** @@ -102,7 +106,8 @@ public function dropDataset(string $datasetName, ?DropAnalyticsDatasetOptions $o */ public function getAllDatasets(?GetAllAnalyticsDatasetsOptions $options = null): array { - $result = Extension\analyticsDatasetGetAll($this->core, GetAllAnalyticsDatasetsOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsDatasetGetAll'; + $result = $function($this->core, GetAllAnalyticsDatasetsOptions::export($options)); $datasets = []; foreach ($result as $dataset) { $datasets[] = AnalyticsDataset::import($dataset); @@ -122,7 +127,8 @@ public function getAllDatasets(?GetAllAnalyticsDatasetsOptions $options = null): */ public function createIndex(string $datasetName, string $indexName, array $fields, ?CreateAnalyticsIndexOptions $options = null): void { - Extension\analyticsIndexCreate($this->core, $datasetName, $indexName, $fields, CreateAnalyticsIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsIndexCreate'; + $function($this->core, $datasetName, $indexName, $fields, CreateAnalyticsIndexOptions::export($options)); } /** @@ -136,7 +142,8 @@ public function createIndex(string $datasetName, string $indexName, array $field */ public function dropIndex(string $datasetName, string $indexName, ?DropAnalyticsIndexOptions $options = null): void { - Extension\analyticsIndexDrop($this->core, $datasetName, $indexName, DropAnalyticsIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsIndexDrop'; + $function($this->core, $datasetName, $indexName, DropAnalyticsIndexOptions::export($options)); } /** @@ -149,7 +156,8 @@ public function dropIndex(string $datasetName, string $indexName, ?DropAnalytics */ public function getAllIndexes(?GetAllAnalyticsIndexesOptions $options = null): array { - $result = Extension\analyticsIndexGetAll($this->core, GetAllAnalyticsIndexesOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsIndexGetAll'; + $result = $function($this->core, GetAllAnalyticsIndexesOptions::export($options)); $indexes = []; foreach ($result as $index) { $indexes[] = AnalyticsIndex::import($index); @@ -166,7 +174,8 @@ public function getAllIndexes(?GetAllAnalyticsIndexesOptions $options = null): a */ public function connectLink(?ConnectAnalyticsLinkOptions $options = null): void { - Extension\analyticsLinkConnect($this->core, ConnectAnalyticsLinkOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsLinkConnect'; + $function($this->core, ConnectAnalyticsLinkOptions::export($options)); } /** @@ -178,7 +187,8 @@ public function connectLink(?ConnectAnalyticsLinkOptions $options = null): void */ public function disconnectLink(?DisconnectAnalyticsLinkOptions $options = null): void { - Extension\analyticsLinkDisconnect($this->core, DisconnectAnalyticsLinkOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsLinkDisconnect'; + $function($this->core, DisconnectAnalyticsLinkOptions::export($options)); } /** @@ -192,7 +202,8 @@ public function disconnectLink(?DisconnectAnalyticsLinkOptions $options = null): */ public function getPendingMutations(?GetAnalyticsPendingMutationsOptions $options = null): array { - $results = Extension\analyticsPendingMutationsGet($this->core, GetAnalyticsPendingMutationsOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsPendingMutationsGet'; + $results = $function($this->core, GetAnalyticsPendingMutationsOptions::export($options)); return GetAnalyticsPendingMutationsOptions::import($results); } @@ -211,7 +222,8 @@ public function getPendingMutations(?GetAnalyticsPendingMutationsOptions $option */ public function createLink(AnalyticsLink $link, ?CreateAnalyticsLinkOptions $options = null): void { - Extension\analyticsLinkCreate($this->core, $link->export(), CreateAnalyticsLinkOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsLinkCreate'; + $function($this->core, $link->export(), CreateAnalyticsLinkOptions::export($options)); } /** @@ -228,7 +240,8 @@ public function createLink(AnalyticsLink $link, ?CreateAnalyticsLinkOptions $opt */ public function replaceLink(AnalyticsLink $link, ?ReplaceAnalyticsLinkOptions $options = null): void { - Extension\analyticsLinkReplace($this->core, $link->export(), ReplaceAnalyticsLinkOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsLinkReplace'; + $function($this->core, $link->export(), ReplaceAnalyticsLinkOptions::export($options)); } /** @@ -242,7 +255,8 @@ public function replaceLink(AnalyticsLink $link, ?ReplaceAnalyticsLinkOptions $o */ public function dropLink(string $linkName, string $dataverseName, ?DropAnalyticsLinkOptions $options = null): void { - Extension\analyticsLinkDrop($this->core, $linkName, $dataverseName, DropAnalyticsLinkOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsLinkDrop'; + $function($this->core, $linkName, $dataverseName, DropAnalyticsLinkOptions::export($options)); } /** @@ -258,7 +272,8 @@ public function dropLink(string $linkName, string $dataverseName, ?DropAnalytics */ public function getLinks(?GetAnalyticsLinksOptions $options = null): array { - $result = Extension\analyticsLinkGetAll($this->core, GetAnalyticsLinksOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsLinkGetAll'; + $result = $function($this->core, GetAnalyticsLinksOptions::export($options)); $links = []; foreach ($result as $link) { $links[] = AnalyticsLink::import($link); diff --git a/Couchbase/Management/BucketManager.php b/Couchbase/Management/BucketManager.php index fb238864..76d0aca0 100644 --- a/Couchbase/Management/BucketManager.php +++ b/Couchbase/Management/BucketManager.php @@ -48,7 +48,8 @@ public function __construct($core) */ public function createBucket(BucketSettings $settings, ?CreateBucketOptions $options = null) { - Extension\bucketCreate($this->core, BucketSettings::export($settings), CreateBucketOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\bucketCreate'; + $function($this->core, BucketSettings::export($settings), CreateBucketOptions::export($options)); } /** @@ -60,7 +61,8 @@ public function createBucket(BucketSettings $settings, ?CreateBucketOptions $opt */ public function updateBucket(BucketSettings $settings, ?UpdateBucketOptions $options = null) { - Extension\bucketUpdate($this->core, BucketSettings::export($settings), UpdateBucketOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\bucketUpdate'; + $function($this->core, BucketSettings::export($settings), UpdateBucketOptions::export($options)); } /** @@ -84,7 +86,8 @@ public function removeBucket(string $name) */ public function dropBucket(string $name, ?DropBucketOptions $options = null) { - Extension\bucketDrop($this->core, $name, DropBucketOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\bucketDrop'; + $function($this->core, $name, DropBucketOptions::export($options)); } /** @@ -96,7 +99,8 @@ public function dropBucket(string $name, ?DropBucketOptions $options = null) */ public function getBucket(string $name, ?GetBucketOptions $options = null): BucketSettings { - $result = Extension\bucketGet($this->core, $name, GetBucketOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\bucketGet'; + $result = $function($this->core, $name, GetBucketOptions::export($options)); return BucketSettings::import($result); } @@ -109,7 +113,8 @@ public function getBucket(string $name, ?GetBucketOptions $options = null): Buck */ public function getAllBuckets(?GetAllBucketsOptions $options = null): array { - $result = Extension\bucketGetAll($this->core, GetAllBucketsOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\bucketGetAll'; + $result = $function($this->core, GetAllBucketsOptions::export($options)); $buckets = []; foreach ($result as $bucket) { $buckets[] = BucketSettings::import($bucket); @@ -126,6 +131,7 @@ public function getAllBuckets(?GetAllBucketsOptions $options = null): array */ public function flush(string $name, ?FlushBucketOptions $options = null) { - Extension\bucketFlush($this->core, $name, FlushBucketOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\bucketFlush'; + $function($this->core, $name, FlushBucketOptions::export($options)); } } diff --git a/Couchbase/Management/CollectionManager.php b/Couchbase/Management/CollectionManager.php index 28d35303..7b027132 100644 --- a/Couchbase/Management/CollectionManager.php +++ b/Couchbase/Management/CollectionManager.php @@ -46,7 +46,9 @@ public function __construct($core, string $bucketName) */ public function getAllScopes(?GetAllScopesOptions $options = null): array { - $result = Extension\scopeGetAll($this->core, $this->bucketName, GetAllScopesOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\scopeGetAll'; + + $result = $function($this->core, $this->bucketName, GetAllScopesOptions::export($options)); $scopes = []; foreach ($result['scopes'] as $scope) { $scopes[] = ScopeSpec::import($scope); @@ -63,7 +65,8 @@ public function getAllScopes(?GetAllScopesOptions $options = null): array */ public function createScope(string $name, ?CreateScopeOptions $options = null) { - Extension\scopeCreate($this->core, $this->bucketName, $name, CreateScopeOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\scopeCreate'; + $function($this->core, $this->bucketName, $name, CreateScopeOptions::export($options)); } /** @@ -75,7 +78,8 @@ public function createScope(string $name, ?CreateScopeOptions $options = null) */ public function dropScope(string $name, ?DropScopeOptions $options = null) { - Extension\scopeDrop($this->core, $this->bucketName, $name, DropScopeOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\scopeDrop'; + $function($this->core, $this->bucketName, $name, DropScopeOptions::export($options)); } /** @@ -104,7 +108,8 @@ public function createCollection($scopeName, $collectionName = null, $settings = $scopeName = $scopeName->scopeName(); } - Extension\collectionCreate($this->core, $this->bucketName, $scopeName, $collectionName, CreateCollectionSettings::export($settings), CreateCollectionOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\collectionCreate'; + $function($this->core, $this->bucketName, $scopeName, $collectionName, CreateCollectionSettings::export($settings), CreateCollectionOptions::export($options)); } /** @@ -130,7 +135,8 @@ public function dropCollection($scopeName, $collectionName = null, $options = nu $collectionName = $scopeName->name(); $scopeName = $scopeName->scopeName(); } - Extension\collectionDrop($this->core, $this->bucketName, $scopeName, $collectionName, DropCollectionOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\collectionDrop'; + $function($this->core, $this->bucketName, $scopeName, $collectionName, DropCollectionOptions::export($options)); } /** @@ -144,6 +150,7 @@ public function dropCollection($scopeName, $collectionName = null, $options = nu */ public function updateCollection(string $scopeName, string $collectionName, UpdateCollectionSettings $settings, ?UpdateCollectionOptions $options = null) { - Extension\collectionUpdate($this->core, $this->bucketName, $scopeName, $collectionName, UpdateCollectionSettings::export($settings), UpdateBucketOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\collectionUpdate'; + $function($this->core, $this->bucketName, $scopeName, $collectionName, UpdateCollectionSettings::export($settings), UpdateBucketOptions::export($options)); } } diff --git a/Couchbase/Management/CollectionQueryIndexManager.php b/Couchbase/Management/CollectionQueryIndexManager.php index 1c4b9baf..8742ecad 100644 --- a/Couchbase/Management/CollectionQueryIndexManager.php +++ b/Couchbase/Management/CollectionQueryIndexManager.php @@ -63,7 +63,8 @@ public function getAllIndexes(?GetAllQueryIndexesOptions $options = null): array { $exported = GetAllQueryIndexesOptions::export($options); $this->checkOptions($exported); - $responses = Extension\collectionQueryIndexGetAll($this->core, $this->bucketName, $this->scopeName, $this->collectionName, $exported); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\collectionQueryIndexGetAll'; + $responses = $function($this->core, $this->bucketName, $this->scopeName, $this->collectionName, $exported); return array_map( function (array $response) { return new QueryIndex($response); @@ -86,7 +87,8 @@ public function createIndex(string $indexName, array $keys, ?CreateQueryIndexOpt { $exported = CreateQueryIndexOptions::export($options); $this->checkOptions($exported); - Extension\collectionQueryIndexCreate($this->core, $this->bucketName, $this->scopeName, $this->collectionName, $indexName, $keys, $exported); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\collectionQueryIndexCreate'; + $function($this->core, $this->bucketName, $this->scopeName, $this->collectionName, $indexName, $keys, $exported); } /** @@ -101,7 +103,8 @@ public function createPrimaryIndex(?CreateQueryPrimaryIndexOptions $options = nu { $exported = CreateQueryPrimaryIndexOptions::export($options); $this->checkOptions($exported); - Extension\collectionQueryIndexCreatePrimary($this->core, $this->bucketName, $this->scopeName, $this->collectionName, $exported); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\collectionQueryIndexCreatePrimary'; + $function($this->core, $this->bucketName, $this->scopeName, $this->collectionName, $exported); } /** @@ -117,7 +120,8 @@ public function dropIndex(string $indexName, ?DropQueryIndexOptions $options = n { $exported = DropQueryIndexOptions::export($options); $this->checkOptions($exported); - Extension\collectionQueryIndexDrop($this->core, $this->bucketName, $this->scopeName, $this->collectionName, $indexName, $exported); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\collectionQueryIndexDrop'; + $function($this->core, $this->bucketName, $this->scopeName, $this->collectionName, $indexName, $exported); } /** @@ -132,7 +136,8 @@ public function dropPrimaryIndex(?DropQueryPrimaryIndexOptions $options = null) { $exported = DropQueryPrimaryIndexOptions::export($options); $this->checkOptions($exported); - Extension\collectionQueryIndexDropPrimary($this->core, $this->bucketName, $this->scopeName, $this->collectionName, $exported); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\collectionQueryIndexDropPrimary'; + $function($this->core, $this->bucketName, $this->scopeName, $this->collectionName, $exported); } /** @@ -147,7 +152,8 @@ public function buildDeferredIndexes(?BuildQueryIndexesOptions $options = null) { $exported = BuildQueryIndexesOptions::export($options); $this->checkOptions($exported); - Extension\collectionQueryIndexBuildDeferred($this->core, $this->bucketName, $this->scopeName, $this->collectionName, $exported); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\collectionQueryIndexBuildDeferred'; + $function($this->core, $this->bucketName, $this->scopeName, $this->collectionName, $exported); } /** diff --git a/Couchbase/Management/QueryIndexManager.php b/Couchbase/Management/QueryIndexManager.php index d1657ee5..c4b34969 100644 --- a/Couchbase/Management/QueryIndexManager.php +++ b/Couchbase/Management/QueryIndexManager.php @@ -52,7 +52,8 @@ public function __construct($core) */ public function getAllIndexes(string $bucketName, ?GetAllQueryIndexesOptions $options = null): array { - $responses = Extension\queryIndexGetAll($this->core, $bucketName, GetAllQueryIndexesOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\queryIndexGetAll'; + $responses = $function($this->core, $bucketName, GetAllQueryIndexesOptions::export($options)); return array_map( function (array $response) { return new QueryIndex($response); @@ -73,7 +74,8 @@ function (array $response) { */ public function createIndex(string $bucketName, string $indexName, array $keys, ?CreateQueryIndexOptions $options = null) { - Extension\queryIndexCreate($this->core, $bucketName, $indexName, $keys, CreateQueryIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\queryIndexCreate'; + $function($this->core, $bucketName, $indexName, $keys, CreateQueryIndexOptions::export($options)); } /** @@ -86,7 +88,8 @@ public function createIndex(string $bucketName, string $indexName, array $keys, */ public function createPrimaryIndex(string $bucketName, ?CreateQueryPrimaryIndexOptions $options = null) { - Extension\queryIndexCreatePrimary($this->core, $bucketName, CreateQueryPrimaryIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\queryIndexCreatePrimary'; + $function($this->core, $bucketName, CreateQueryPrimaryIndexOptions::export($options)); } /** @@ -100,7 +103,8 @@ public function createPrimaryIndex(string $bucketName, ?CreateQueryPrimaryIndexO */ public function dropIndex(string $bucketName, string $indexName, ?DropQueryIndexOptions $options = null) { - Extension\queryIndexDrop($this->core, $bucketName, $indexName, DropQueryIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\queryIndexDrop'; + $function($this->core, $bucketName, $indexName, DropQueryIndexOptions::export($options)); } /** @@ -113,7 +117,8 @@ public function dropIndex(string $bucketName, string $indexName, ?DropQueryIndex */ public function dropPrimaryIndex(string $bucketName, ?DropQueryPrimaryIndexOptions $options = null) { - Extension\queryIndexDropPrimary($this->core, $bucketName, DropQueryPrimaryIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\queryIndexDropPrimary'; + $function($this->core, $bucketName, DropQueryPrimaryIndexOptions::export($options)); } /** @@ -126,7 +131,8 @@ public function dropPrimaryIndex(string $bucketName, ?DropQueryPrimaryIndexOptio */ public function buildDeferredIndexes(string $bucketName, ?BuildQueryIndexesOptions $options = null) { - Extension\queryIndexBuildDeferred($this->core, $bucketName, BuildQueryIndexesOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\queryIndexBuildDeferred'; + $function($this->core, $bucketName, BuildQueryIndexesOptions::export($options)); } /** diff --git a/Couchbase/Management/ScopeSearchIndexManager.php b/Couchbase/Management/ScopeSearchIndexManager.php index e7960972..86c7f8fb 100644 --- a/Couchbase/Management/ScopeSearchIndexManager.php +++ b/Couchbase/Management/ScopeSearchIndexManager.php @@ -46,7 +46,8 @@ public function __construct($core, string $bucketName, string $scopeName) */ public function getIndex(string $indexName, ?GetSearchIndexOptions $options = null): SearchIndex { - $result = Extension\scopeSearchIndexGet($this->core, $this->bucketName, $this->scopeName, $indexName, GetSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\scopeSearchIndexGet'; + $result = $function($this->core, $this->bucketName, $this->scopeName, $indexName, GetSearchIndexOptions::export($options)); return SearchIndex::import($result); } @@ -61,7 +62,8 @@ public function getIndex(string $indexName, ?GetSearchIndexOptions $options = nu */ public function getAllIndexes(?GetAllSearchIndexesOptions $options = null): array { - $result = Extension\scopeSearchIndexGetAll($this->core, $this->bucketName, $this->scopeName, GetAllSearchIndexesOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\scopeSearchIndexGetAll'; + $result = $function($this->core, $this->bucketName, $this->scopeName, GetAllSearchIndexesOptions::export($options)); $indexes = []; foreach ($result as $index) { $indexes[] = SearchIndex::import($index); @@ -79,7 +81,8 @@ public function getAllIndexes(?GetAllSearchIndexesOptions $options = null): arra */ public function upsertIndex(SearchIndex $indexDefinition, ?UpsertSearchIndexOptions $options = null) { - Extension\scopeSearchIndexUpsert($this->core, $this->bucketName, $this->scopeName, SearchIndex::export($indexDefinition), UpsertSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\scopeSearchIndexUpsert'; + $function($this->core, $this->bucketName, $this->scopeName, SearchIndex::export($indexDefinition), UpsertSearchIndexOptions::export($options)); } /** @@ -92,7 +95,8 @@ public function upsertIndex(SearchIndex $indexDefinition, ?UpsertSearchIndexOpti */ public function dropIndex(string $name, ?DropSearchIndexOptions $options = null) { - Extension\scopeSearchIndexDrop($this->core, $this->bucketName, $this->scopeName, $name, DropSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\scopeSearchIndexDrop'; + $function($this->core, $this->bucketName, $this->scopeName, $name, DropSearchIndexOptions::export($options)); } /** @@ -106,7 +110,8 @@ public function dropIndex(string $name, ?DropSearchIndexOptions $options = null) */ public function getIndexedDocumentsCount(string $indexName, ?GetIndexedSearchIndexOptions $options = null): int { - $result = Extension\scopeSearchIndexGetDocumentsCount($this->core, $this->bucketName, $this->scopeName, $indexName, GetIndexedSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\scopeSearchIndexGetDocumentsCount'; + $result = $function($this->core, $this->bucketName, $this->scopeName, $indexName, GetIndexedSearchIndexOptions::export($options)); return $result['count']; } @@ -120,7 +125,8 @@ public function getIndexedDocumentsCount(string $indexName, ?GetIndexedSearchInd */ public function pauseIngest(string $indexName, ?PauseIngestSearchIndexOptions $options = null) { - Extension\scopeSearchIndexIngestPause($this->core, $this->bucketName, $this->scopeName, $indexName, PauseIngestSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\scopeSearchIndexIngestPause'; + $function($this->core, $this->bucketName, $this->scopeName, $indexName, PauseIngestSearchIndexOptions::export($options)); } /** @@ -133,7 +139,8 @@ public function pauseIngest(string $indexName, ?PauseIngestSearchIndexOptions $o */ public function resumeIngest(string $indexName, ?ResumeIngestSearchIndexOptions $options = null) { - Extension\scopeSearchIndexIngestResume($this->core, $this->bucketName, $this->scopeName, $indexName, ResumeIngestSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\scopeSearchIndexIngestResume'; + $function($this->core, $this->bucketName, $this->scopeName, $indexName, ResumeIngestSearchIndexOptions::export($options)); } /** @@ -146,7 +153,8 @@ public function resumeIngest(string $indexName, ?ResumeIngestSearchIndexOptions */ public function allowQuerying(string $indexName, ?AllowQueryingSearchIndexOptions $options = null) { - Extension\scopeSearchIndexQueryingAllow($this->core, $this->bucketName, $this->scopeName, $indexName, AllowQueryingSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\scopeSearchIndexQueryingAllow'; + $function($this->core, $this->bucketName, $this->scopeName, $indexName, AllowQueryingSearchIndexOptions::export($options)); } /** @@ -159,7 +167,8 @@ public function allowQuerying(string $indexName, ?AllowQueryingSearchIndexOption */ public function disallowQuerying(string $indexName, ?DisallowQueryingSearchIndexOptions $options = null) { - Extension\scopeSearchIndexQueryingDisallow($this->core, $this->bucketName, $this->scopeName, $indexName, DisallowQueryingSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\scopeSearchIndexQueryingDisallow'; + $function($this->core, $this->bucketName, $this->scopeName, $indexName, DisallowQueryingSearchIndexOptions::export($options)); } /** @@ -172,7 +181,8 @@ public function disallowQuerying(string $indexName, ?DisallowQueryingSearchIndex */ public function freezePlan(string $indexName, ?FreezePlanSearchIndexOptions $options = null) { - Extension\scopeSearchIndexPlanFreeze($this->core, $this->bucketName, $this->scopeName, $indexName, FreezePlanSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\scopeSearchIndexPlanFreeze'; + $function($this->core, $this->bucketName, $this->scopeName, $indexName, FreezePlanSearchIndexOptions::export($options)); } /** @@ -185,7 +195,8 @@ public function freezePlan(string $indexName, ?FreezePlanSearchIndexOptions $opt */ public function unfreezePlan(string $indexName, ?UnfreezePlanSearchIndexOptions $options = null) { - Extension\scopeSearchIndexPlanUnfreeze($this->core, $this->bucketName, $this->scopeName, $indexName, UnfreezePlanSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\scopeSearchIndexPlanUnfreeze'; + $function($this->core, $this->bucketName, $this->scopeName, $indexName, UnfreezePlanSearchIndexOptions::export($options)); } /** @@ -200,7 +211,8 @@ public function unfreezePlan(string $indexName, ?UnfreezePlanSearchIndexOptions */ public function analyzeDocument(string $indexName, $document, ?AnalyzeDocumentOptions $options = null): array { - $result = Extension\scopeSearchIndexDocumentAnalyze($this->core, $this->bucketName, $this->scopeName, $indexName, json_encode($document), AnalyzeDocumentOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\scopeSearchIndexDocumentAnalyze'; + $result = $function($this->core, $this->bucketName, $this->scopeName, $indexName, json_encode($document), AnalyzeDocumentOptions::export($options)); return json_decode($result["analysis"], true); } } diff --git a/Couchbase/Management/SearchIndexManager.php b/Couchbase/Management/SearchIndexManager.php index 3ea9de71..a8bad7ee 100644 --- a/Couchbase/Management/SearchIndexManager.php +++ b/Couchbase/Management/SearchIndexManager.php @@ -53,7 +53,8 @@ public function __construct($core) */ public function getIndex(string $indexName, ?GetSearchIndexOptions $options = null): SearchIndex { - $result = Extension\searchIndexGet($this->core, $indexName, GetSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\searchIndexGet'; + $result = $function($this->core, $indexName, GetSearchIndexOptions::export($options)); return SearchIndex::import($result); } @@ -68,7 +69,8 @@ public function getIndex(string $indexName, ?GetSearchIndexOptions $options = nu */ public function getAllIndexes(?GetAllSearchIndexesOptions $options = null): array { - $result = Extension\searchIndexGetAll($this->core, GetAllSearchIndexesOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\searchIndexGetAll'; + $result = $function($this->core, GetAllSearchIndexesOptions::export($options)); $indexes = []; foreach ($result as $index) { $indexes[] = SearchIndex::import($index); @@ -86,7 +88,8 @@ public function getAllIndexes(?GetAllSearchIndexesOptions $options = null): arra */ public function upsertIndex(SearchIndex $indexDefinition, ?UpsertSearchIndexOptions $options = null) { - Extension\searchIndexUpsert($this->core, SearchIndex::export($indexDefinition), UpsertSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\searchIndexUpsert'; + $function($this->core, SearchIndex::export($indexDefinition), UpsertSearchIndexOptions::export($options)); } /** @@ -99,7 +102,8 @@ public function upsertIndex(SearchIndex $indexDefinition, ?UpsertSearchIndexOpti */ public function dropIndex(string $name, ?DropSearchIndexOptions $options = null) { - Extension\searchIndexDrop($this->core, $name, DropSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\searchIndexDrop'; + $function($this->core, $name, DropSearchIndexOptions::export($options)); } /** @@ -113,7 +117,8 @@ public function dropIndex(string $name, ?DropSearchIndexOptions $options = null) */ public function getIndexedDocumentsCount(string $indexName, ?GetIndexedSearchIndexOptions $options = null): int { - $result = Extension\searchIndexGetDocumentsCount($this->core, $indexName, GetIndexedSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\searchIndexGetDocumentsCount'; + $result = $function($this->core, $indexName, GetIndexedSearchIndexOptions::export($options)); return $result['count']; } @@ -127,7 +132,8 @@ public function getIndexedDocumentsCount(string $indexName, ?GetIndexedSearchInd */ public function pauseIngest(string $indexName, ?PauseIngestSearchIndexOptions $options = null) { - Extension\searchIndexIngestPause($this->core, $indexName, PauseIngestSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\searchIndexIngestPause'; + $function($this->core, $indexName, PauseIngestSearchIndexOptions::export($options)); } /** @@ -140,7 +146,8 @@ public function pauseIngest(string $indexName, ?PauseIngestSearchIndexOptions $o */ public function resumeIngest(string $indexName, ?ResumeIngestSearchIndexOptions $options = null) { - Extension\searchIndexIngestResume($this->core, $indexName, ResumeIngestSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\searchIndexIngestResume'; + $function($this->core, $indexName, ResumeIngestSearchIndexOptions::export($options)); } /** @@ -153,7 +160,8 @@ public function resumeIngest(string $indexName, ?ResumeIngestSearchIndexOptions */ public function allowQuerying(string $indexName, ?AllowQueryingSearchIndexOptions $options = null) { - Extension\searchIndexQueryingAllow($this->core, $indexName, AllowQueryingSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\searchIndexQueryingAllow'; + $function($this->core, $indexName, AllowQueryingSearchIndexOptions::export($options)); } /** @@ -166,7 +174,8 @@ public function allowQuerying(string $indexName, ?AllowQueryingSearchIndexOption */ public function disallowQuerying(string $indexName, ?DisallowQueryingSearchIndexOptions $options = null) { - Extension\searchIndexQueryingDisallow($this->core, $indexName, DisallowQueryingSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\searchIndexQueryingDisallow'; + $function($this->core, $indexName, DisallowQueryingSearchIndexOptions::export($options)); } /** @@ -179,7 +188,8 @@ public function disallowQuerying(string $indexName, ?DisallowQueryingSearchIndex */ public function freezePlan(string $indexName, ?FreezePlanSearchIndexOptions $options = null) { - Extension\searchIndexPlanFreeze($this->core, $indexName, FreezePlanSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\searchIndexPlanFreeze'; + $function($this->core, $indexName, FreezePlanSearchIndexOptions::export($options)); } /** @@ -191,7 +201,8 @@ public function freezePlan(string $indexName, ?FreezePlanSearchIndexOptions $opt */ public function unfreezePlan(string $indexName, ?UnfreezePlanSearchIndexOptions $options = null) { - Extension\searchIndexPlanUnfreeze($this->core, $indexName, UnfreezePlanSearchIndexOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\searchIndexPlanUnfreeze'; + $function($this->core, $indexName, UnfreezePlanSearchIndexOptions::export($options)); } /** @@ -206,7 +217,8 @@ public function unfreezePlan(string $indexName, ?UnfreezePlanSearchIndexOptions */ public function analyzeDocument(string $indexName, $document, ?AnalyzeDocumentOptions $options = null): array { - $result = Extension\searchIndexDocumentAnalyze($this->core, $indexName, json_encode($document), AnalyzeDocumentOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\searchIndexDocumentAnalyze'; + $result = $function($this->core, $indexName, json_encode($document), AnalyzeDocumentOptions::export($options)); return json_decode($result["analysis"], true); } } diff --git a/Couchbase/Management/UserManager.php b/Couchbase/Management/UserManager.php index fd906ef0..02bb2526 100644 --- a/Couchbase/Management/UserManager.php +++ b/Couchbase/Management/UserManager.php @@ -49,7 +49,8 @@ public function __construct($core) */ public function getUser(string $name, ?GetUserOptions $options = null): UserAndMetadata { - $result = Extension\userGet($this->core, $name, GetUserOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\userGet'; + $result = $function($this->core, $name, GetUserOptions::export($options)); return UserAndMetadata::import($result); } @@ -62,7 +63,8 @@ public function getUser(string $name, ?GetUserOptions $options = null): UserAndM */ public function getAllUsers(?GetAllUsersOptions $options = null): array { - $result = Extension\userGetAll($this->core, GetAllUsersOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\userGetAll'; + $result = $function($this->core, GetAllUsersOptions::export($options)); $users = []; foreach ($result as $user) { $users[] = UserAndMetadata::import($user); @@ -80,7 +82,8 @@ public function getAllUsers(?GetAllUsersOptions $options = null): array */ public function upsertUser(User $user, ?UpsertUserOptions $options = null) { - Extension\userUpsert($this->core, User::export($user), UpsertUserOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\userUpsert'; + $function($this->core, User::export($user), UpsertUserOptions::export($options)); } /** @@ -92,7 +95,8 @@ public function upsertUser(User $user, ?UpsertUserOptions $options = null) */ public function dropUser(string $name, ?DropUserOptions $options = null) { - Extension\userDrop($this->core, $name, DropUserOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\userDrop'; + $function($this->core, $name, DropUserOptions::export($options)); } /** @@ -105,7 +109,8 @@ public function dropUser(string $name, ?DropUserOptions $options = null) */ public function getRoles(?GetRolesOptions $options = null): array { - $result = Extension\roleGetAll($this->core, GetRolesOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\roleGetAll'; + $result = $function($this->core, GetRolesOptions::export($options)); foreach ($result as $role) { $roles[] = RoleAndDescription::import($role); } @@ -123,7 +128,8 @@ public function getRoles(?GetRolesOptions $options = null): array */ public function getGroup(string $name, ?GetGroupOptions $options = null): Group { - $result = Extension\groupGet($this->core, $name, GetGroupOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\groupGet'; + $result = $function($this->core, $name, GetGroupOptions::export($options)); return Group::import($result); } @@ -137,7 +143,8 @@ public function getGroup(string $name, ?GetGroupOptions $options = null): Group */ public function getAllGroups(?GetAllGroupsOptions $options = null): array { - $result = Extension\groupGetAll($this->core, GetAllGroupsOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\groupGetAll'; + $result = $function($this->core, GetAllGroupsOptions::export($options)); $groups = []; foreach ($result as $group) { $groups[] = Group::import($group); @@ -155,7 +162,8 @@ public function getAllGroups(?GetAllGroupsOptions $options = null): array */ public function upsertGroup(Group $group, ?UpsertGroupOptions $options = null) { - Extension\groupUpsert($this->core, Group::export($group), UpsertGroupOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\groupUpsert'; + $function($this->core, Group::export($group), UpsertGroupOptions::export($options)); } /** @@ -167,7 +175,8 @@ public function upsertGroup(Group $group, ?UpsertGroupOptions $options = null) */ public function dropGroup(string $name, ?DropGroupOptions $options = null) { - Extension\groupDrop($this->core, $name, DropGroupOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\groupDrop'; + $function($this->core, $name, DropGroupOptions::export($options)); } /** @@ -178,6 +187,7 @@ public function dropGroup(string $name, ?DropGroupOptions $options = null) */ public function changePassword(string $newPassword, ?ChangePasswordOptions $options = null) { - Extension\passwordChange($this->core, $newPassword, ChangePasswordOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\passwordChange'; + $function($this->core, $newPassword, ChangePasswordOptions::export($options)); } } diff --git a/Couchbase/ScanResults.php b/Couchbase/ScanResults.php index ace1df55..259162f5 100644 --- a/Couchbase/ScanResults.php +++ b/Couchbase/ScanResults.php @@ -49,7 +49,8 @@ class ScanResults implements IteratorAggregate */ public function __construct($core, string $bucketName, string $scopeName, string $collectionName, array $type, array $options, Transcoder $transcoder) { - $this->coreScanResult = Extension\createDocumentScanResult( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\createDocumentScanResult'; + $this->coreScanResult = $function( $core, $bucketName, $scopeName, @@ -70,10 +71,11 @@ public function __construct($core, string $bucketName, string $scopeName, string public function getIterator(): Traversable { return (function () { - $res = Extension\documentScanNextItem($this->coreScanResult); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\documentScanNextItem'; + $res = $function($this->coreScanResult); while (!is_null($res)) { yield new ScanResult($res, $this->transcoder); - $res = Extension\documentScanNextItem($this->coreScanResult); + $res = $function($this->coreScanResult); } })(); } diff --git a/Couchbase/Scope.php b/Couchbase/Scope.php index a8a4de0f..b77d8076 100644 --- a/Couchbase/Scope.php +++ b/Couchbase/Scope.php @@ -91,7 +91,8 @@ public function collection(string $name): CollectionInterface */ public function query(string $statement, ?QueryOptions $options = null): QueryResult { - $result = Extension\query($this->core, $statement, QueryOptions::export($options, $this->name, $this->bucketName)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\query'; + $result = $function($this->core, $statement, QueryOptions::export($options, $this->name, $this->bucketName)); return new QueryResult($result, QueryOptions::getTranscoder($options)); } @@ -109,7 +110,8 @@ public function query(string $statement, ?QueryOptions $options = null): QueryRe */ public function analyticsQuery(string $statement, ?AnalyticsOptions $options = null): AnalyticsResult { - $result = Extension\analyticsQuery($this->core, $statement, AnalyticsOptions::export($options, $this->name, $this->bucketName)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\analyticsQuery'; + $result = $function($this->core, $statement, AnalyticsOptions::export($options, $this->name, $this->bucketName)); return new AnalyticsResult($result, AnalyticsOptions::getTranscoder($options)); } @@ -139,12 +141,14 @@ public function search(string $indexName, SearchRequest $request, ?SearchOptions $query = $exportedRequest['searchQuery']; if (!$exportedRequest['vectorSearch']) { - $result = Extension\searchQuery($this->core, $indexName, json_encode($query), $exportedOptions); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\searchQuery'; + $result = $function($this->core, $indexName, json_encode($query), $exportedOptions); return new SearchResult($result); } $vectorSearch = $exportedRequest['vectorSearch']; - $result = Extension\vectorSearch($this->core, $indexName, json_encode($query), json_encode($vectorSearch), $exportedOptions, VectorSearchOptions::export($vectorSearch->options())); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\vectorSearch'; + $result = $function($this->core, $indexName, json_encode($query), json_encode($vectorSearch), $exportedOptions, VectorSearchOptions::export($vectorSearch->options())); return new SearchResult($result); } diff --git a/Couchbase/TransactionAttemptContext.php b/Couchbase/TransactionAttemptContext.php index 0cbd15cb..949bbdab 100644 --- a/Couchbase/TransactionAttemptContext.php +++ b/Couchbase/TransactionAttemptContext.php @@ -51,7 +51,8 @@ public function __construct($transaction) */ public function get(Collection $collection, string $id): TransactionGetResult { - $response = Extension\transactionGet( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\transactionGet'; + $response = $function( $this->transaction, $collection->bucketName(), $collection->scopeName(), @@ -75,7 +76,8 @@ public function get(Collection $collection, string $id): TransactionGetResult public function insert(Collection $collection, string $id, $value): TransactionGetResult { $encoded = InsertOptions::encodeDocument(null, $value); - $response = Extension\transactionInsert( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\transactionInsert'; + $response = $function( $this->transaction, $collection->bucketName(), $collection->scopeName(), @@ -99,7 +101,8 @@ public function insert(Collection $collection, string $id, $value): TransactionG public function replace(TransactionGetResult $document, $value): TransactionGetResult { $encoded = ReplaceOptions::encodeDocument(null, $value); - $response = Extension\transactionReplace( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\transactionReplace'; + $response = $function( $this->transaction, $document->export(), $encoded[0] /* ignore flags */ @@ -118,7 +121,8 @@ public function replace(TransactionGetResult $document, $value): TransactionGetR */ public function remove(TransactionGetResult $document) { - Extension\transactionRemove( + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\transactionRemove'; + $function( $this->transaction, $document->export(), ); @@ -135,7 +139,8 @@ public function remove(TransactionGetResult $document) */ public function query(string $statement, ?TransactionQueryOptions $options = null) { - $result = Extension\transactionQuery($this->transaction, $statement, TransactionQueryOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\transactionQuery'; + $result = $function($this->transaction, $statement, TransactionQueryOptions::export($options)); return new QueryResult($result, TransactionQueryOptions::getTranscoder($options)); } diff --git a/Couchbase/TransactionAttemptContextDetails.php b/Couchbase/TransactionAttemptContextDetails.php index cafe836e..99ab5c71 100644 --- a/Couchbase/TransactionAttemptContextDetails.php +++ b/Couchbase/TransactionAttemptContextDetails.php @@ -41,7 +41,8 @@ class TransactionAttemptContextDetails */ public function __construct($transactions, ?TransactionOptions $options = null) { - $this->transaction = Extension\createTransactionContext($transactions, TransactionOptions::export($options)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\createTransactionContext'; + $this->transaction = $function($transactions, TransactionOptions::export($options)); } /** @@ -61,7 +62,8 @@ public function transactionAttemptContext(): TransactionAttemptContext */ public function newAttempt() { - return Extension\transactionNewAttempt($this->transaction); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\transactionNewAttempt'; + return $function($this->transaction); } /** @@ -71,7 +73,8 @@ public function newAttempt() */ public function rollback() { - return Extension\transactionRollback($this->transaction); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\transactionRollback'; + return $function($this->transaction); } /** @@ -81,7 +84,8 @@ public function rollback() */ public function commit(): ?TransactionResult { - $response = Extension\transactionCommit($this->transaction); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\transactionCommit'; + $response = $function($this->transaction); if ($response) { return new TransactionResult($response); } diff --git a/Couchbase/Transactions.php b/Couchbase/Transactions.php index c9e334fb..82d6aa43 100644 --- a/Couchbase/Transactions.php +++ b/Couchbase/Transactions.php @@ -40,7 +40,8 @@ class Transactions */ public function __construct($core, ?TransactionsConfiguration $configuration = null) { - $this->transactions = Extension\createTransactions($core, TransactionsConfiguration::export($configuration)); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\createTransactions'; + $this->transactions = $function($core, TransactionsConfiguration::export($configuration)); } /** diff --git a/Makefile.frag b/Makefile.frag index 88945a8f..63fdb4ea 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -7,6 +7,7 @@ $(COUCHBASE_CMAKE_BUILD_DIRECTORY)/CMakeCache.txt: $(COUCHBASE_CMAKE_SOURCE_DIRE -DCMAKE_CXX_COMPILER="$(CXX)" \ -DCMAKE_C_FLAGS="$(COMMON_FLAGS)" \ -DCMAKE_CXX_FLAGS="$(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS)" \ + -DCOUCHBASE_ABI_VERSION="$(CB_ABI_VERSION)" \ -DCOUCHBASE_PHP_INCLUDES="$(INCLUDES)" \ -DCOUCHBASE_PHP_LIBDIR="$(phplibdir)" diff --git a/bin/build.rb b/bin/build.rb index b7daba8b..eed20019 100755 --- a/bin/build.rb +++ b/bin/build.rb @@ -100,8 +100,17 @@ def run(*args) run("#{CB_PHP_PREFIX}/bin/php -d extension=#{COUCHBASE_EXT} -i | grep couchbase") File.write("#{PROJECT_ROOT}/build/try_to_load.php", <getFileName()); diff --git a/bin/test.rb b/bin/test.rb index bcfd382e..6071e996 100755 --- a/bin/test.rb +++ b/bin/test.rb @@ -19,6 +19,7 @@ require "fileutils" require "rbconfig" require "shellwords" +require 'optparse' DEFAULT_PHP_NAME = "php" CB_PHP_NAME = ENV.fetch("CB_PHP_NAME", DEFAULT_PHP_NAME) @@ -68,6 +69,24 @@ def capture(*args) output end +def find_extension(name_pattern, project_root, module_location_candidates) + module_names = [ + "#{name_pattern}.#{RbConfig::CONFIG['DLEXT']}", + "#{name_pattern}.#{RbConfig::CONFIG['SOEXT']}", + "#{name_pattern}.so", + ].map { |name| ["php_#{name}", name] }.flatten + + module_locations = module_names.map do |name| + [ + "#{project_root}/modules/#{name}", + "#{project_root}/#{name}", + ] + Dir["#{project_root}/couchbase*/**/#{name}"] + end.flatten.sort.uniq + + module_locations.each { |path| module_location_candidates << path } + module_locations.find { |path| File.exist?(path) } +end + if ENV["CB_VALGRIND"] ENV["USE_ZEND_ALLOC"] = 0 ENV["ZEND_DONT_UNLOAD_MODULES"] = 1 @@ -117,23 +136,31 @@ def capture(*args) run("curl -L -o #{php_unit_phar.shellescape} #{php_unit_url}") end -module_names = [ - "couchbase.#{RbConfig::CONFIG['DLEXT']}", - "couchbase.#{RbConfig::CONFIG['SOEXT']}", - "couchbase.so", -].map { |name| ["php_#{name}", name] }.flatten -module_locations = module_names.map do |name| - [ - "#{project_root}/modules/#{name}", - "#{project_root}/#{name}", - ] + Dir["#{project_root}/couchbase*/**/#{name}"] -end.flatten.sort.uniq - -couchbase_ext = module_locations.find { |path| File.exist?(path) } -if couchbase_ext - puts "Found module: #{couchbase_ext}" -else - abort "Unable to find the module. Candidates: #{module_locations.inspect}" +abi_versions = [] + +OptionParser.new do |opt| + opt.on("-v abi", "--version abi", "Add abi") do |abi| + abi_versions.push(abi) + end +end.parse! + +abi_versions = ["unversioned"] if abi_versions.empty? + +module_location_candidates = [] +extra_php_args = [] + +abi_versions.each do |v| + if v == "unversioned" + ext = find_extension("couchbase", project_root, module_location_candidates) + extra_php_args << "-d" << "extension=#{ext}" + else + ext = find_extension("couchbase_" + v, project_root, module_location_candidates) + extra_php_args << "-d" << "extension=#{ext}" + end +end + +if extra_php_args.empty? + abort "Unable to find the module. Candidates: #{module_location_candidates.inspect}" end tests = ARGV.to_a @@ -157,21 +184,19 @@ def capture(*args) log_args << "-d" << "couchbase.log_level=#{log_level}" end -extra_php_args = [] if windows? extra_php_args << "-d" << "extension=sockets" extra_php_args << "-d" << "extension=mbstring" end Dir.chdir(project_root) do - run(CB_PHP_EXECUTABLE, *extra_php_args, "-d", "extension=#{couchbase_ext}", "-m") - puts capture(CB_PHP_EXECUTABLE, *extra_php_args, "-d", "extension=#{couchbase_ext}", "-i") + run(CB_PHP_EXECUTABLE, *extra_php_args, "-m") + puts capture(CB_PHP_EXECUTABLE, *extra_php_args, "-i") .split("\n") .grep(/couchbase/i) .join("\n") run(CB_PHP_EXECUTABLE, *extra_php_args, - "-d", "extension=#{couchbase_ext}", "-d", "couchbase.log_php_log_err=0", *log_args, php_unit_phar, diff --git a/config.w32 b/config.w32 index 2543bf9d..9ec5acfc 100644 --- a/config.w32 +++ b/config.w32 @@ -39,6 +39,7 @@ if (PHP_COUCHBASE != "no") { var COUCHBASE_PHP_LIB = (MODE_PHPIZE ? PHP_DIR + "\\lib" : get_define("BUILD_DIR")) + "\\" + get_define("PHPLIB"); + var COUCHBASE_ABI_VERSION = WshShell.Environment("Process").Item("CB_ABI_VERSION") || ""; STDOUT.WriteLine('CMAKE="' + CMAKE + '" # version: ' + probe_binary(CMAKE, "longversion")); STDOUT.WriteLine('NASM="' + NASM + '" # version: ' + probe_binary(NASM, "version")); @@ -47,6 +48,7 @@ if (PHP_COUCHBASE != "no") { STDOUT.WriteLine('COUCHBASE_PHP_CFLAGS="' + COUCHBASE_PHP_CFLAGS + '"'); STDOUT.WriteLine('COUCHBASE_PHP_INCLUDES="' + COUCHBASE_PHP_INCLUDES + '"'); STDOUT.WriteLine('COUCHBASE_PHP_LIB="' + COUCHBASE_PHP_LIB + '"'); + STDOUT.WriteLine('COUCHBASE_ABI_VERSION="' + COUCHBASE_ABI_VERSION + '"'); // Override build rules. CMake is in charge of the build process. MFO.WriteLine("$(BUILD_DIR)\\php_couchbase.lib: $(BUILD_DIR)\\php_couchbase.dll"); @@ -79,7 +81,8 @@ if (PHP_COUCHBASE != "no") { ' -D COUCHBASE_CXX_CLIENT_BUILD_EXAMPLES=OFF ' + ' -D COUCHBASE_CXX_CLIENT_BUILD_TOOLS=OFF ' + ' -D COUCHBASE_CXX_CLIENT_BUILD_DOCS=OFF ' + - ' -D COUCHBASE_CXX_CLIENT_BUILD_TESTS=OFF" 2>&1'; + ' -D COUCHBASE_ABI_VERSION="' + COUCHBASE_ABI_VERSION + '"' + + ' -D COUCHBASE_CXX_CLIENT_BUILD_TESTS=OFF" 2>&1 '; STDOUT.WriteLine(cmake_command); cmake_output = execute(cmake_command); STDOUT.WriteLine(cmake_output); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b956e4af..fe4a0c24 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -106,6 +106,12 @@ target_link_libraries( fmt::fmt asio Microsoft.GSL::GSL) + +message ("COUCHBASE_ABI_VERSION=${COUCHBASE_ABI_VERSION}") +if( COUCHBASE_ABI_VERSION ) + target_compile_definitions(couchbase PRIVATE COUCHBASE_ABI_VERSION=${COUCHBASE_ABI_VERSION}) +endif() + if(APPLE) target_link_libraries(couchbase PRIVATE -Wl,-undefined,dynamic_lookup) endif() @@ -114,6 +120,9 @@ if(WIN32) target_compile_definitions(couchbase PRIVATE NOMINMAX) target_link_options(couchbase PUBLIC "${COUCHBASE_PHP_LIB}") endif() + +set_target_properties(couchbase PROPERTIES C_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden) + if(COUCHBASE_PHP_LIBDIR) add_custom_command( TARGET couchbase diff --git a/src/php_couchbase.cxx b/src/php_couchbase.cxx index 6752d0d5..53e94588 100644 --- a/src/php_couchbase.cxx +++ b/src/php_couchbase.cxx @@ -193,6 +193,7 @@ couchbase_throw_exception(const couchbase::php::core_error_info& error_info) zend_throw_exception_object(&ex); } +namespace { PHP_MSHUTDOWN_FUNCTION(couchbase) { couchbase::php::shutdown_logger(); @@ -226,6 +227,12 @@ PHP_FUNCTION(notifyFork) RETURN_NULL(); } +PHP_FUNCTION(loadExceptionAliases) +{ + couchbase::php::initialize_exception_aliases(); + RETURN_NULL(); +} + PHP_FUNCTION(createConnection) { zend_string* connection_hash = nullptr; @@ -3713,12 +3720,18 @@ static PHP_MINFO_FUNCTION(couchbase) { php_info_print_table_start(); php_info_print_table_row(2, "couchbase", "enabled"); +#ifdef COUCHBASE_ABI_VERSION + php_info_print_table_row(2, "couchbase_extension_abi", TOSTRING(COUCHBASE_ABI_VERSION)); +#else + php_info_print_table_row(2, "couchbase_extension_abi", "unspecified"); +#endif php_info_print_table_row(2, "couchbase_extension_version", PHP_COUCHBASE_VERSION); php_info_print_table_row(2, "couchbase_extension_revision", couchbase::php::extension_revision()); php_info_print_table_row(2, "couchbase_client_revision", couchbase::php::cxx_client_revision()); php_info_print_table_end(); DISPLAY_INI_ENTRIES(); } +} ZEND_BEGIN_ARG_INFO_EX(ai_CouchbaseExtension_version, 0, 0, 0) ZEND_END_ARG_INFO() @@ -3727,6 +3740,9 @@ ZEND_BEGIN_ARG_INFO_EX(ai_CouchbaseExtension_notifyFork, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, forkEvent, IS_STRING, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(ai_CouchbaseExtension_loadExceptionAliases, 0, 0, 0) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(ai_CouchbaseExtension_clusterVersion, 0, 0, 2) ZEND_ARG_INFO(0, connection) ZEND_ARG_TYPE_INFO(0, bucketName, IS_STRING, 0) @@ -4600,133 +4616,134 @@ ZEND_END_ARG_INFO() // clang-format off static zend_function_entry couchbase_functions[] = { - ZEND_NS_FE("Couchbase\\Extension", notifyFork, ai_CouchbaseExtension_notifyFork) - ZEND_NS_FE("Couchbase\\Extension", version, ai_CouchbaseExtension_version) - ZEND_NS_FE("Couchbase\\Extension", clusterVersion, ai_CouchbaseExtension_clusterVersion) - ZEND_NS_FE("Couchbase\\Extension", replicasConfiguredForBucket, ai_CouchbaseExtension_replicasConfiguredForBucket) - ZEND_NS_FE("Couchbase\\Extension", createConnection, ai_CouchbaseExtension_createConnection) - ZEND_NS_FE("Couchbase\\Extension", openBucket, ai_CouchbaseExtension_openBucket) - ZEND_NS_FE("Couchbase\\Extension", closeBucket, ai_CouchbaseExtension_closeBucket) - ZEND_NS_FE("Couchbase\\Extension", documentUpsert, ai_CouchbaseExtension_documentUpsert) - ZEND_NS_FE("Couchbase\\Extension", documentInsert, ai_CouchbaseExtension_documentInsert) - ZEND_NS_FE("Couchbase\\Extension", documentReplace, ai_CouchbaseExtension_documentReplace) - ZEND_NS_FE("Couchbase\\Extension", documentAppend, ai_CouchbaseExtension_documentAppend) - ZEND_NS_FE("Couchbase\\Extension", documentPrepend, ai_CouchbaseExtension_documentPrepend) - ZEND_NS_FE("Couchbase\\Extension", documentIncrement, ai_CouchbaseExtension_documentIncrement) - ZEND_NS_FE("Couchbase\\Extension", documentDecrement, ai_CouchbaseExtension_documentDecrement) - ZEND_NS_FE("Couchbase\\Extension", documentGet, ai_CouchbaseExtension_documentGet) - ZEND_NS_FE("Couchbase\\Extension", documentGetAnyReplica, ai_CouchbaseExtension_documentGetAnyReplica) - ZEND_NS_FE("Couchbase\\Extension", documentGetAllReplicas, ai_CouchbaseExtension_documentGetAllReplicas) - ZEND_NS_FE("Couchbase\\Extension", documentGetAndTouch, ai_CouchbaseExtension_documentGetAndTouch) - ZEND_NS_FE("Couchbase\\Extension", documentGetAndLock, ai_CouchbaseExtension_documentGetAndLock) - ZEND_NS_FE("Couchbase\\Extension", documentUnlock, ai_CouchbaseExtension_documentUnlock) - ZEND_NS_FE("Couchbase\\Extension", documentRemove, ai_CouchbaseExtension_documentRemove) - ZEND_NS_FE("Couchbase\\Extension", documentTouch, ai_CouchbaseExtension_documentTouch) - ZEND_NS_FE("Couchbase\\Extension", documentExists, ai_CouchbaseExtension_documentExists) - ZEND_NS_FE("Couchbase\\Extension", documentMutateIn, ai_CouchbaseExtension_documentMutateIn) - ZEND_NS_FE("Couchbase\\Extension", documentLookupIn, ai_CouchbaseExtension_documentLookupIn) - ZEND_NS_FE("Couchbase\\Extension", createDocumentScanResult, ai_CouchbaseExtension_createDocumentScanResult) - ZEND_NS_FE("Couchbase\\Extension", documentScanNextItem, ai_CouchbaseExtension_documentScanNextItem) - ZEND_NS_FE("Couchbase\\Extension", documentLookupInAnyReplica, ai_CouchbaseExtension_documentLookupInAnyReplica) - ZEND_NS_FE("Couchbase\\Extension", documentLookupInAllReplicas, ai_CouchbaseExtension_documentLookupInAllReplicas) - ZEND_NS_FE("Couchbase\\Extension", documentGetMulti, ai_CouchbaseExtension_documentGetMulti) - ZEND_NS_FE("Couchbase\\Extension", documentRemoveMulti, ai_CouchbaseExtension_documentRemoveMulti) - ZEND_NS_FE("Couchbase\\Extension", documentUpsertMulti, ai_CouchbaseExtension_documentUpsertMulti) - ZEND_NS_FE("Couchbase\\Extension", query, ai_CouchbaseExtension_query) - ZEND_NS_FE("Couchbase\\Extension", analyticsQuery, ai_CouchbaseExtension_analyticsQuery) - ZEND_NS_FE("Couchbase\\Extension", viewQuery, ai_CouchbaseExtension_viewQuery) - ZEND_NS_FE("Couchbase\\Extension", searchQuery, ai_CouchbaseExtension_searchQuery) - ZEND_NS_FE("Couchbase\\Extension", vectorSearch, ai_CouchbaseExtension_vectorSearch) - ZEND_NS_FE("Couchbase\\Extension", ping, ai_CouchbaseExtension_ping) - ZEND_NS_FE("Couchbase\\Extension", diagnostics, ai_CouchbaseExtension_diagnostics) - - ZEND_NS_FE("Couchbase\\Extension", createTransactions, ai_CouchbaseExtension_createTransactions) - ZEND_NS_FE("Couchbase\\Extension", createTransactionContext, ai_CouchbaseExtension_createTransactionContext) - ZEND_NS_FE("Couchbase\\Extension", transactionNewAttempt, ai_CouchbaseExtension_transactionNewAttempt) - ZEND_NS_FE("Couchbase\\Extension", transactionCommit, ai_CouchbaseExtension_transactionCommit) - ZEND_NS_FE("Couchbase\\Extension", transactionRollback, ai_CouchbaseExtension_transactionRollback) - ZEND_NS_FE("Couchbase\\Extension", transactionGet, ai_CouchbaseExtension_transactionGet) - ZEND_NS_FE("Couchbase\\Extension", transactionInsert, ai_CouchbaseExtension_transactionInsert) - ZEND_NS_FE("Couchbase\\Extension", transactionReplace, ai_CouchbaseExtension_transactionReplace) - ZEND_NS_FE("Couchbase\\Extension", transactionRemove, ai_CouchbaseExtension_transactionRemove) - ZEND_NS_FE("Couchbase\\Extension", transactionQuery, ai_CouchbaseExtension_transactionQuery) - - ZEND_NS_FE("Couchbase\\Extension", searchIndexGet, ai_CouchbaseExtension_searchIndexGet) - ZEND_NS_FE("Couchbase\\Extension", searchIndexGetAll, ai_CouchbaseExtension_searchIndexGetAll) - ZEND_NS_FE("Couchbase\\Extension", searchIndexUpsert, ai_CouchbaseExtension_searchIndexUpsert) - ZEND_NS_FE("Couchbase\\Extension", searchIndexDrop, ai_CouchbaseExtension_searchIndexDrop) - ZEND_NS_FE("Couchbase\\Extension", searchIndexGetDocumentsCount, ai_CouchbaseExtension_searchIndexGetDocumentsCount) - ZEND_NS_FE("Couchbase\\Extension", searchIndexIngestPause, ai_CouchbaseExtension_searchIndexIngestPause) - ZEND_NS_FE("Couchbase\\Extension", searchIndexIngestResume, ai_CouchbaseExtension_searchIndexIngestResume) - ZEND_NS_FE("Couchbase\\Extension", searchIndexQueryingAllow, ai_CouchbaseExtension_searchIndexQueryingAllow) - ZEND_NS_FE("Couchbase\\Extension", searchIndexQueryingDisallow, ai_CouchbaseExtension_searchIndexQueryingDisallow) - ZEND_NS_FE("Couchbase\\Extension", searchIndexPlanFreeze, ai_CouchbaseExtension_searchIndexPlanFreeze) - ZEND_NS_FE("Couchbase\\Extension", searchIndexPlanUnfreeze, ai_CouchbaseExtension_searchIndexPlanUnfreeze) - ZEND_NS_FE("Couchbase\\Extension", searchIndexDocumentAnalyze, ai_CouchbaseExtension_searchIndexDocumentAnalyze) - ZEND_NS_FE("Couchbase\\Extension", scopeSearchIndexGet, ai_CouchbaseExtension_scopeSearchIndexGet) - ZEND_NS_FE("Couchbase\\Extension", scopeSearchIndexGetAll, ai_CouchbaseExtension_scopeSearchIndexGetAll) - ZEND_NS_FE("Couchbase\\Extension", scopeSearchIndexUpsert, ai_CouchbaseExtension_scopeSearchIndexUpsert) - ZEND_NS_FE("Couchbase\\Extension", scopeSearchIndexDrop, ai_CouchbaseExtension_scopeSearchIndexDrop) - ZEND_NS_FE("Couchbase\\Extension", scopeSearchIndexGetDocumentsCount, ai_CouchbaseExtension_scopeSearchIndexGetDocumentsCount) - ZEND_NS_FE("Couchbase\\Extension", scopeSearchIndexIngestPause, ai_CouchbaseExtension_scopeSearchIndexIngestPause) - ZEND_NS_FE("Couchbase\\Extension", scopeSearchIndexIngestResume, ai_CouchbaseExtension_scopeSearchIndexIngestResume) - ZEND_NS_FE("Couchbase\\Extension", scopeSearchIndexQueryingAllow, ai_CouchbaseExtension_scopeSearchIndexQueryingAllow) - ZEND_NS_FE("Couchbase\\Extension", scopeSearchIndexQueryingDisallow, ai_CouchbaseExtension_scopeSearchIndexQueryingDisallow) - ZEND_NS_FE("Couchbase\\Extension", scopeSearchIndexPlanFreeze, ai_CouchbaseExtension_scopeSearchIndexPlanFreeze) - ZEND_NS_FE("Couchbase\\Extension", scopeSearchIndexPlanUnfreeze, ai_CouchbaseExtension_scopeSearchIndexPlanUnfreeze) - ZEND_NS_FE("Couchbase\\Extension", scopeSearchIndexDocumentAnalyze, ai_CouchbaseExtension_scopeSearchIndexDocumentAnalyze) - ZEND_NS_FE("Couchbase\\Extension", viewIndexUpsert, ai_CouchbaseExtension_viewIndexUpsert) - ZEND_NS_FE("Couchbase\\Extension", bucketCreate, ai_CouchbaseExtension_bucketCreate) - ZEND_NS_FE("Couchbase\\Extension", bucketUpdate, ai_CouchbaseExtension_bucketUpdate) - ZEND_NS_FE("Couchbase\\Extension", bucketGet, ai_CouchbaseExtension_bucketGet) - ZEND_NS_FE("Couchbase\\Extension", bucketGetAll, ai_CouchbaseExtension_bucketGetAll) - ZEND_NS_FE("Couchbase\\Extension", bucketDrop, ai_CouchbaseExtension_bucketDrop) - ZEND_NS_FE("Couchbase\\Extension", bucketFlush, ai_CouchbaseExtension_bucketFlush) - ZEND_NS_FE("Couchbase\\Extension", scopeGetAll, ai_CouchbaseExtension_scopeGetAll) - ZEND_NS_FE("Couchbase\\Extension", scopeCreate, ai_CouchbaseExtension_scopeCreate) - ZEND_NS_FE("Couchbase\\Extension", scopeDrop, ai_CouchbaseExtension_scopeDrop) - ZEND_NS_FE("Couchbase\\Extension", collectionCreate, ai_CouchbaseExtension_collectionCreate) - ZEND_NS_FE("Couchbase\\Extension", collectionDrop, ai_CouchbaseExtension_collectionDrop) - ZEND_NS_FE("Couchbase\\Extension", collectionUpdate, ai_CouchbaseExtension_collectionUpdate) - ZEND_NS_FE("Couchbase\\Extension", userUpsert, ai_CouchbaseExtension_userUpsert) - ZEND_NS_FE("Couchbase\\Extension", userGet, ai_CouchbaseExtension_userGet) - ZEND_NS_FE("Couchbase\\Extension", userGetAll, ai_CouchbaseExtension_userGetAll) - ZEND_NS_FE("Couchbase\\Extension", userDrop, ai_CouchbaseExtension_userDrop) - ZEND_NS_FE("Couchbase\\Extension", passwordChange, ai_CouchbaseExtension_passwordChange) - ZEND_NS_FE("Couchbase\\Extension", groupUpsert, ai_CouchbaseExtension_groupUpsert) - ZEND_NS_FE("Couchbase\\Extension", groupGet, ai_CouchbaseExtension_groupGet) - ZEND_NS_FE("Couchbase\\Extension", groupGetAll, ai_CouchbaseExtension_groupGetAll) - ZEND_NS_FE("Couchbase\\Extension", groupDrop, ai_CouchbaseExtension_groupDrop) - ZEND_NS_FE("Couchbase\\Extension", roleGetAll, ai_CouchbaseExtension_roleGetAll) - - ZEND_NS_FE("Couchbase\\Extension", queryIndexGetAll, ai_CouchbaseExtension_queryIndexGetAll) - ZEND_NS_FE("Couchbase\\Extension", queryIndexCreate, ai_CouchbaseExtension_queryIndexCreate) - ZEND_NS_FE("Couchbase\\Extension", queryIndexCreatePrimary, ai_CouchbaseExtension_queryIndexCreatePrimary) - ZEND_NS_FE("Couchbase\\Extension", queryIndexDrop, ai_CouchbaseExtension_queryIndexDrop) - ZEND_NS_FE("Couchbase\\Extension", queryIndexDropPrimary, ai_CouchbaseExtension_queryIndexDropPrimary) - ZEND_NS_FE("Couchbase\\Extension", queryIndexBuildDeferred, ai_CouchbaseExtension_queryIndexBuildDeferred) - ZEND_NS_FE("Couchbase\\Extension", collectionQueryIndexGetAll, ai_CouchbaseExtension_collectionQueryIndexGetAll) - ZEND_NS_FE("Couchbase\\Extension", collectionQueryIndexCreate, ai_CouchbaseExtension_collectionQueryIndexCreate) - ZEND_NS_FE("Couchbase\\Extension", collectionQueryIndexCreatePrimary, ai_CouchbaseExtension_collectionQueryIndexCreatePrimary) - ZEND_NS_FE("Couchbase\\Extension", collectionQueryIndexDrop, ai_CouchbaseExtension_collectionQueryIndexDrop) - ZEND_NS_FE("Couchbase\\Extension", collectionQueryIndexDropPrimary, ai_CouchbaseExtension_collectionQueryIndexDropPrimary) - ZEND_NS_FE("Couchbase\\Extension", collectionQueryIndexBuildDeferred, ai_CouchbaseExtension_collectionQueryIndexBuildDeferred) - - ZEND_NS_FE("Couchbase\\Extension", analyticsDataverseCreate, ai_CouchbaseExtension_analyticsDataverseCreate) - ZEND_NS_FE("Couchbase\\Extension", analyticsDataverseDrop, ai_CouchbaseExtension_analyticsDataverseDrop) - ZEND_NS_FE("Couchbase\\Extension", analyticsDatasetCreate, ai_CouchbaseExtension_analyticsDatasetCreate) - ZEND_NS_FE("Couchbase\\Extension", analyticsDatasetDrop, ai_CouchbaseExtension_analyticsDatasetDrop) - ZEND_NS_FE("Couchbase\\Extension", analyticsDatasetGetAll, ai_CouchbaseExtension_analyticsDatasetGetAll) - ZEND_NS_FE("Couchbase\\Extension", analyticsIndexCreate, ai_CouchbaseExtension_analyticsIndexCreate) - ZEND_NS_FE("Couchbase\\Extension", analyticsIndexDrop, ai_CouchbaseExtension_analyticsIndexDrop) - ZEND_NS_FE("Couchbase\\Extension", analyticsIndexGetAll, ai_CouchbaseExtension_analyticsIndexGetAll) - ZEND_NS_FE("Couchbase\\Extension", analyticsLinkConnect, ai_CouchbaseExtension_analyticsLinkConnect) - ZEND_NS_FE("Couchbase\\Extension", analyticsLinkDisconnect, ai_CouchbaseExtension_analyticsLinkDisconnect) - ZEND_NS_FE("Couchbase\\Extension", analyticsPendingMutationsGet, ai_CouchbaseExtension_analyticsPendingMutationsGet) - ZEND_NS_FE("Couchbase\\Extension", analyticsLinkCreate, ai_CouchbaseExtension_analyticsLinkCreate) - ZEND_NS_FE("Couchbase\\Extension", analyticsLinkReplace, ai_CouchbaseExtension_analyticsLinkReplace) - ZEND_NS_FE("Couchbase\\Extension", analyticsLinkDrop, ai_CouchbaseExtension_analyticsLinkDrop) - ZEND_NS_FE("Couchbase\\Extension", analyticsLinkGetAll, ai_CouchbaseExtension_analyticsLinkGetAll) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, notifyFork, ai_CouchbaseExtension_notifyFork) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, loadExceptionAliases, ai_CouchbaseExtension_loadExceptionAliases) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, version, ai_CouchbaseExtension_version) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, clusterVersion, ai_CouchbaseExtension_clusterVersion) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, replicasConfiguredForBucket, ai_CouchbaseExtension_replicasConfiguredForBucket) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, createConnection, ai_CouchbaseExtension_createConnection) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, openBucket, ai_CouchbaseExtension_openBucket) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, closeBucket, ai_CouchbaseExtension_closeBucket) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentUpsert, ai_CouchbaseExtension_documentUpsert) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentInsert, ai_CouchbaseExtension_documentInsert) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentReplace, ai_CouchbaseExtension_documentReplace) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentAppend, ai_CouchbaseExtension_documentAppend) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentPrepend, ai_CouchbaseExtension_documentPrepend) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentIncrement, ai_CouchbaseExtension_documentIncrement) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentDecrement, ai_CouchbaseExtension_documentDecrement) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentGet, ai_CouchbaseExtension_documentGet) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentGetAnyReplica, ai_CouchbaseExtension_documentGetAnyReplica) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentGetAllReplicas, ai_CouchbaseExtension_documentGetAllReplicas) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentGetAndTouch, ai_CouchbaseExtension_documentGetAndTouch) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentGetAndLock, ai_CouchbaseExtension_documentGetAndLock) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentUnlock, ai_CouchbaseExtension_documentUnlock) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentRemove, ai_CouchbaseExtension_documentRemove) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentTouch, ai_CouchbaseExtension_documentTouch) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentExists, ai_CouchbaseExtension_documentExists) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentMutateIn, ai_CouchbaseExtension_documentMutateIn) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentLookupIn, ai_CouchbaseExtension_documentLookupIn) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, createDocumentScanResult, ai_CouchbaseExtension_createDocumentScanResult) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentScanNextItem, ai_CouchbaseExtension_documentScanNextItem) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentLookupInAnyReplica, ai_CouchbaseExtension_documentLookupInAnyReplica) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentLookupInAllReplicas, ai_CouchbaseExtension_documentLookupInAllReplicas) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentGetMulti, ai_CouchbaseExtension_documentGetMulti) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentRemoveMulti, ai_CouchbaseExtension_documentRemoveMulti) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, documentUpsertMulti, ai_CouchbaseExtension_documentUpsertMulti) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, query, ai_CouchbaseExtension_query) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, analyticsQuery, ai_CouchbaseExtension_analyticsQuery) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, viewQuery, ai_CouchbaseExtension_viewQuery) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, searchQuery, ai_CouchbaseExtension_searchQuery) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, vectorSearch, ai_CouchbaseExtension_vectorSearch) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, ping, ai_CouchbaseExtension_ping) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, diagnostics, ai_CouchbaseExtension_diagnostics) + + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, createTransactions, ai_CouchbaseExtension_createTransactions) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, createTransactionContext, ai_CouchbaseExtension_createTransactionContext) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, transactionNewAttempt, ai_CouchbaseExtension_transactionNewAttempt) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, transactionCommit, ai_CouchbaseExtension_transactionCommit) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, transactionRollback, ai_CouchbaseExtension_transactionRollback) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, transactionGet, ai_CouchbaseExtension_transactionGet) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, transactionInsert, ai_CouchbaseExtension_transactionInsert) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, transactionReplace, ai_CouchbaseExtension_transactionReplace) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, transactionRemove, ai_CouchbaseExtension_transactionRemove) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, transactionQuery, ai_CouchbaseExtension_transactionQuery) + + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, searchIndexGet, ai_CouchbaseExtension_searchIndexGet) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, searchIndexGetAll, ai_CouchbaseExtension_searchIndexGetAll) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, searchIndexUpsert, ai_CouchbaseExtension_searchIndexUpsert) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, searchIndexDrop, ai_CouchbaseExtension_searchIndexDrop) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, searchIndexGetDocumentsCount, ai_CouchbaseExtension_searchIndexGetDocumentsCount) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, searchIndexIngestPause, ai_CouchbaseExtension_searchIndexIngestPause) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, searchIndexIngestResume, ai_CouchbaseExtension_searchIndexIngestResume) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, searchIndexQueryingAllow, ai_CouchbaseExtension_searchIndexQueryingAllow) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, searchIndexQueryingDisallow, ai_CouchbaseExtension_searchIndexQueryingDisallow) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, searchIndexPlanFreeze, ai_CouchbaseExtension_searchIndexPlanFreeze) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, searchIndexPlanUnfreeze, ai_CouchbaseExtension_searchIndexPlanUnfreeze) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, searchIndexDocumentAnalyze, ai_CouchbaseExtension_searchIndexDocumentAnalyze) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, scopeSearchIndexGet, ai_CouchbaseExtension_scopeSearchIndexGet) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, scopeSearchIndexGetAll, ai_CouchbaseExtension_scopeSearchIndexGetAll) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, scopeSearchIndexUpsert, ai_CouchbaseExtension_scopeSearchIndexUpsert) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, scopeSearchIndexDrop, ai_CouchbaseExtension_scopeSearchIndexDrop) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, scopeSearchIndexGetDocumentsCount, ai_CouchbaseExtension_scopeSearchIndexGetDocumentsCount) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, scopeSearchIndexIngestPause, ai_CouchbaseExtension_scopeSearchIndexIngestPause) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, scopeSearchIndexIngestResume, ai_CouchbaseExtension_scopeSearchIndexIngestResume) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, scopeSearchIndexQueryingAllow, ai_CouchbaseExtension_scopeSearchIndexQueryingAllow) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, scopeSearchIndexQueryingDisallow, ai_CouchbaseExtension_scopeSearchIndexQueryingDisallow) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, scopeSearchIndexPlanFreeze, ai_CouchbaseExtension_scopeSearchIndexPlanFreeze) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, scopeSearchIndexPlanUnfreeze, ai_CouchbaseExtension_scopeSearchIndexPlanUnfreeze) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, scopeSearchIndexDocumentAnalyze, ai_CouchbaseExtension_scopeSearchIndexDocumentAnalyze) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, viewIndexUpsert, ai_CouchbaseExtension_viewIndexUpsert) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, bucketCreate, ai_CouchbaseExtension_bucketCreate) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, bucketUpdate, ai_CouchbaseExtension_bucketUpdate) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, bucketGet, ai_CouchbaseExtension_bucketGet) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, bucketGetAll, ai_CouchbaseExtension_bucketGetAll) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, bucketDrop, ai_CouchbaseExtension_bucketDrop) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, bucketFlush, ai_CouchbaseExtension_bucketFlush) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, scopeGetAll, ai_CouchbaseExtension_scopeGetAll) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, scopeCreate, ai_CouchbaseExtension_scopeCreate) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, scopeDrop, ai_CouchbaseExtension_scopeDrop) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, collectionCreate, ai_CouchbaseExtension_collectionCreate) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, collectionDrop, ai_CouchbaseExtension_collectionDrop) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, collectionUpdate, ai_CouchbaseExtension_collectionUpdate) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, userUpsert, ai_CouchbaseExtension_userUpsert) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, userGet, ai_CouchbaseExtension_userGet) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, userGetAll, ai_CouchbaseExtension_userGetAll) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, userDrop, ai_CouchbaseExtension_userDrop) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, passwordChange, ai_CouchbaseExtension_passwordChange) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, groupUpsert, ai_CouchbaseExtension_groupUpsert) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, groupGet, ai_CouchbaseExtension_groupGet) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, groupGetAll, ai_CouchbaseExtension_groupGetAll) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, groupDrop, ai_CouchbaseExtension_groupDrop) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, roleGetAll, ai_CouchbaseExtension_roleGetAll) + + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, queryIndexGetAll, ai_CouchbaseExtension_queryIndexGetAll) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, queryIndexCreate, ai_CouchbaseExtension_queryIndexCreate) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, queryIndexCreatePrimary, ai_CouchbaseExtension_queryIndexCreatePrimary) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, queryIndexDrop, ai_CouchbaseExtension_queryIndexDrop) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, queryIndexDropPrimary, ai_CouchbaseExtension_queryIndexDropPrimary) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, queryIndexBuildDeferred, ai_CouchbaseExtension_queryIndexBuildDeferred) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, collectionQueryIndexGetAll, ai_CouchbaseExtension_collectionQueryIndexGetAll) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, collectionQueryIndexCreate, ai_CouchbaseExtension_collectionQueryIndexCreate) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, collectionQueryIndexCreatePrimary, ai_CouchbaseExtension_collectionQueryIndexCreatePrimary) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, collectionQueryIndexDrop, ai_CouchbaseExtension_collectionQueryIndexDrop) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, collectionQueryIndexDropPrimary, ai_CouchbaseExtension_collectionQueryIndexDropPrimary) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, collectionQueryIndexBuildDeferred, ai_CouchbaseExtension_collectionQueryIndexBuildDeferred) + + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, analyticsDataverseCreate, ai_CouchbaseExtension_analyticsDataverseCreate) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, analyticsDataverseDrop, ai_CouchbaseExtension_analyticsDataverseDrop) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, analyticsDatasetCreate, ai_CouchbaseExtension_analyticsDatasetCreate) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, analyticsDatasetDrop, ai_CouchbaseExtension_analyticsDatasetDrop) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, analyticsDatasetGetAll, ai_CouchbaseExtension_analyticsDatasetGetAll) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, analyticsIndexCreate, ai_CouchbaseExtension_analyticsIndexCreate) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, analyticsIndexDrop, ai_CouchbaseExtension_analyticsIndexDrop) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, analyticsIndexGetAll, ai_CouchbaseExtension_analyticsIndexGetAll) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, analyticsLinkConnect, ai_CouchbaseExtension_analyticsLinkConnect) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, analyticsLinkDisconnect, ai_CouchbaseExtension_analyticsLinkDisconnect) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, analyticsPendingMutationsGet, ai_CouchbaseExtension_analyticsPendingMutationsGet) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, analyticsLinkCreate, ai_CouchbaseExtension_analyticsLinkCreate) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, analyticsLinkReplace, ai_CouchbaseExtension_analyticsLinkReplace) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, analyticsLinkDrop, ai_CouchbaseExtension_analyticsLinkDrop) + ZEND_NS_FE("Couchbase\\Extension" COUCHBASE_NAMESPACE_ABI_SUFFIX, analyticsLinkGetAll, ai_CouchbaseExtension_analyticsLinkGetAll) PHP_FE_END }; diff --git a/src/php_couchbase.hxx b/src/php_couchbase.hxx index f4f51dd3..4001c075 100644 --- a/src/php_couchbase.hxx +++ b/src/php_couchbase.hxx @@ -19,8 +19,16 @@ #include +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) + +#ifdef COUCHBASE_ABI_VERSION + #define PHP_COUCHBASE_EXTENSION_NAME "couchbase" "_" TOSTRING(COUCHBASE_ABI_VERSION) +#else + #define PHP_COUCHBASE_EXTENSION_NAME "couchbase" +#endif + #define PHP_COUCHBASE_VERSION "4.2.4" -#define PHP_COUCHBASE_EXTENSION_NAME "couchbase" #ifdef __cplusplus extern "C" { diff --git a/src/wrapper/common.cxx b/src/wrapper/common.cxx index 8841af4e..aa8850e7 100644 --- a/src/wrapper/common.cxx +++ b/src/wrapper/common.cxx @@ -123,176 +123,325 @@ void initialize_exceptions(const zend_function_entry* exception_functions) { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "CouchbaseException", exception_functions); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "CouchbaseException", exception_functions); couchbase_exception_ce = zend_register_internal_class_ex(&ce, zend_ce_exception); zend_declare_property_null(couchbase_exception_ce, ZEND_STRL("context"), ZEND_ACC_PRIVATE); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "TimeoutException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "TimeoutException", nullptr); timeout_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "UnambiguousTimeoutException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "UnambiguousTimeoutException", nullptr); unambiguous_timeout_exception_ce = zend_register_internal_class_ex(&ce, timeout_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "AmbiguousTimeoutException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "AmbiguousTimeoutException", nullptr); ambiguous_timeout_exception_ce = zend_register_internal_class_ex(&ce, timeout_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "AuthenticationFailureException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "AuthenticationFailureException", nullptr); authentication_failure_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "BucketExistsException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "BucketExistsException", nullptr); bucket_exists_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "BucketNotFlushableException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "BucketNotFlushableException", nullptr); bucket_not_flushable_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "BucketNotFoundException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "BucketNotFoundException", nullptr); bucket_not_found_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "CasMismatchException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "CasMismatchException", nullptr); cas_mismatch_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "CollectionExistsException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "CollectionExistsException", nullptr); collection_exists_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "CollectionNotFoundException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "CollectionNotFoundException", nullptr); collection_not_found_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "CompilationFailureException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "CompilationFailureException", nullptr); compilation_failure_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "ConsistencyMismatchException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "ConsistencyMismatchException", nullptr); consistency_mismatch_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DatasetExistsException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DatasetExistsException", nullptr); dataset_exists_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DatasetNotFoundException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DatasetNotFoundException", nullptr); dataset_not_found_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DataverseExistsException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DataverseExistsException", nullptr); dataverse_exists_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DataverseNotFoundException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DataverseNotFoundException", nullptr); dataverse_not_found_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DecodingFailureException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DecodingFailureException", nullptr); decoding_failure_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DeltaInvalidException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DeltaInvalidException", nullptr); delta_invalid_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DesignDocumentNotFoundException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DesignDocumentNotFoundException", nullptr); design_document_not_found_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DocumentExistsException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DocumentExistsException", nullptr); document_exists_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DocumentIrretrievableException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DocumentIrretrievableException", nullptr); document_irretrievable_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DocumentLockedException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DocumentLockedException", nullptr); document_locked_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DocumentNotFoundException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DocumentNotFoundException", nullptr); document_not_found_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DocumentNotLockedException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DocumentNotLockedException", nullptr); document_not_locked_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DocumentNotJsonException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DocumentNotJsonException", nullptr); document_not_json_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DurabilityAmbiguousException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DurabilityAmbiguousException", nullptr); durability_ambiguous_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DurabilityImpossibleException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DurabilityImpossibleException", nullptr); durability_impossible_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DurabilityLevelNotAvailableException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DurabilityLevelNotAvailableException", nullptr); durability_level_not_available_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "DurableWriteInProgressException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DurableWriteInProgressException", nullptr); durable_write_in_progress_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); INIT_NS_CLASS_ENTRY( - ce, "Couchbase\\Exception", "DurableWriteReCommitInProgressException", nullptr); + ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "DurableWriteReCommitInProgressException", nullptr); durable_write_re_commit_in_progress_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "EncodingFailureException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "EncodingFailureException", nullptr); encoding_failure_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "FeatureNotAvailableException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "FeatureNotAvailableException", nullptr); feature_not_available_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "GroupNotFoundException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "GroupNotFoundException", nullptr); group_not_found_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "IndexExistsException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "IndexExistsException", nullptr); index_exists_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "IndexFailureException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "IndexFailureException", nullptr); index_failure_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "IndexNotFoundException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "IndexNotFoundException", nullptr); index_not_found_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "IndexNotReadyException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "IndexNotReadyException", nullptr); index_not_ready_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "InternalServerFailureException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "InternalServerFailureException", nullptr); internal_server_failure_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "InvalidArgumentException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "InvalidArgumentException", nullptr); invalid_argument_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "JobQueueFullException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "JobQueueFullException", nullptr); job_queue_full_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "LinkExistsException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "LinkExistsException", nullptr); link_exists_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "LinkNotFoundException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "LinkNotFoundException", nullptr); link_not_found_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "NumberTooBigException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "NumberTooBigException", nullptr); number_too_big_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "ParsingFailureException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "ParsingFailureException", nullptr); parsing_failure_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "PathExistsException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "PathExistsException", nullptr); path_exists_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "PathInvalidException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "PathInvalidException", nullptr); path_invalid_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "PathMismatchException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "PathMismatchException", nullptr); path_mismatch_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "PathNotFoundException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "PathNotFoundException", nullptr); path_not_found_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "PathTooBigException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "PathTooBigException", nullptr); path_too_big_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "PathTooDeepException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "PathTooDeepException", nullptr); path_too_deep_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "PermissionDeniedException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "PermissionDeniedException", nullptr); permission_denied_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "PlanningFailureException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "PlanningFailureException", nullptr); planning_failure_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "PreparedStatementFailureException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "PreparedStatementFailureException", nullptr); prepared_statement_failure_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "RequestCanceledException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "RequestCanceledException", nullptr); request_canceled_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "ScopeExistsException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "ScopeExistsException", nullptr); scope_exists_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "ScopeNotFoundException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "ScopeNotFoundException", nullptr); scope_not_found_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "ServiceNotAvailableException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "ServiceNotAvailableException", nullptr); service_not_available_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "TemporaryFailureException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "TemporaryFailureException", nullptr); temporary_failure_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "UnsupportedOperationException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "UnsupportedOperationException", nullptr); unsupported_operation_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "UserExistsException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "UserExistsException", nullptr); user_exists_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "UserNotFoundException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "UserNotFoundException", nullptr); user_not_found_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "ValueInvalidException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "ValueInvalidException", nullptr); value_invalid_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "ValueTooDeepException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "ValueTooDeepException", nullptr); value_too_deep_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "ValueTooLargeException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "ValueTooLargeException", nullptr); value_too_large_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "ViewNotFoundException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "ViewNotFoundException", nullptr); view_not_found_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); INIT_NS_CLASS_ENTRY( - ce, "Couchbase\\Exception", "XattrCannotModifyVirtualAttributeException", nullptr); + ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "XattrCannotModifyVirtualAttributeException", nullptr); xattr_cannot_modify_virtual_attribute_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "XattrInvalidKeyComboException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "XattrInvalidKeyComboException", nullptr); xattr_invalid_key_combo_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "XattrUnknownMacroException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "XattrUnknownMacroException", nullptr); xattr_unknown_macro_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "XattrUnknownVirtualAttributeException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "XattrUnknownVirtualAttributeException", nullptr); xattr_unknown_virtual_attribute_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "TransactionException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "TransactionException", nullptr); transaction_exception_ce = zend_register_internal_class_ex(&ce, couchbase_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "TransactionOperationFailedException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "TransactionOperationFailedException", nullptr); transaction_operation_failed_exception_ce = zend_register_internal_class_ex(&ce, transaction_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "TransactionFailedException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "TransactionFailedException", nullptr); transaction_failed_exception_ce = zend_register_internal_class_ex(&ce, transaction_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "TransactionExpiredException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "TransactionExpiredException", nullptr); transaction_expired_exception_ce = zend_register_internal_class_ex(&ce, transaction_exception_ce); - INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception", "TransactionCommitAmbiguousException", nullptr); + INIT_NS_CLASS_ENTRY(ce, "Couchbase\\Exception" COUCHBASE_NAMESPACE_ABI_SUFFIX, "TransactionCommitAmbiguousException", nullptr); transaction_commit_ambiguous_exception_ce = zend_register_internal_class_ex(&ce, transaction_exception_ce); } +COUCHBASE_API +void +initialize_exception_aliases() +{ + zend_register_class_alias("Couchbase\\Exception\\CouchbaseException", couchbase_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\TimeoutException", timeout_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\UnambiguousTimeoutException", + unambiguous_timeout_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\AmbiguousTimeoutException", + ambiguous_timeout_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\AuthenticationFailureException", + authentication_failure_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\BucketExistsException", + bucket_exists_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\BucketNotFlushableException", + bucket_not_flushable_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\BucketNotFoundException", + bucket_not_found_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\CasMismatchException", + cas_mismatch_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\CollectionExistsException", + collection_exists_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\CollectionNotFoundException", + collection_not_found_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\CompilationFailureException", + compilation_failure_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\ConsistencyMismatchException", + consistency_mismatch_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DatasetExistsException", + dataset_exists_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DatasetNotFoundException", + dataset_not_found_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DataverseExistsException", + dataverse_exists_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DataverseNotFoundException", + dataverse_not_found_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DecodingFailureException", + decoding_failure_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DeltaInvalidException", + delta_invalid_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DesignDocumentNotFoundException", + design_document_not_found_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DocumentExistsException", + document_exists_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DocumentIrretrievableException", + document_irretrievable_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DocumentLockedException", + document_locked_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DocumentNotFoundException", + document_not_found_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DocumentNotLockedException", + document_not_locked_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DocumentNotJsonException", + document_not_json_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DurabilityAmbiguousException", + durability_ambiguous_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DurabilityImpossibleException", + durability_impossible_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DurabilityLevelNotAvailableException", + durability_level_not_available_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DurableWriteInProgressException", + durable_write_in_progress_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\DurableWriteReCommitInProgressException", + durable_write_re_commit_in_progress_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\EncodingFailureException", + encoding_failure_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\FeatureNotAvailableException", + feature_not_available_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\GroupNotFoundException", + group_not_found_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\IndexExistsException", + index_exists_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\IndexFailureException", + index_failure_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\IndexNotFoundException", + index_not_found_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\IndexNotReadyException", + index_not_ready_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\InternalServerFailureException", + internal_server_failure_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\InvalidArgumentException", + invalid_argument_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\JobQueueFullException", + job_queue_full_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\LinkExistsException", link_exists_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\LinkNotFoundException", + link_not_found_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\NumberTooBigException", + number_too_big_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\ParsingFailureException", + parsing_failure_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\PathExistsException", path_exists_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\PathInvalidException", + path_invalid_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\PathMismatchException", + path_mismatch_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\PathNotFoundException", + path_not_found_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\PathTooBigException", path_too_big_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\PathTooDeepException", + path_too_deep_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\PermissionDeniedException", + permission_denied_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\PlanningFailureException", + planning_failure_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\PreparedStatementFailureException", + prepared_statement_failure_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\RequestCanceledException", + request_canceled_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\ScopeExistsException", + scope_exists_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\ScopeNotFoundException", + scope_not_found_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\ServiceNotAvailableException", + service_not_available_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\TemporaryFailureException", + temporary_failure_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\UnsupportedOperationException", + unsupported_operation_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\UserExistsException", user_exists_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\UserNotFoundException", + user_not_found_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\ValueInvalidException", + value_invalid_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\ValueTooDeepException", + value_too_deep_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\ValueTooLargeException", + value_too_large_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\ViewNotFoundException", + view_not_found_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\XattrCannotModifyVirtualAttributeException", + xattr_cannot_modify_virtual_attribute_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\XattrInvalidKeyComboException", + xattr_invalid_key_combo_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\XattrUnknownMacroException", + xattr_unknown_macro_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\XattrUnknownVirtualAttributeException", + xattr_unknown_virtual_attribute_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\TransactionException", transaction_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\TransactionOperationFailedException", + transaction_operation_failed_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\TransactionFailedException", + transaction_failed_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\TransactionExpiredException", + transaction_expired_exception_ce); + zend_register_class_alias("Couchbase\\Exception\\TransactionCommitAmbiguousException", + transaction_commit_ambiguous_exception_ce); +} + COUCHBASE_API zend_class_entry* map_error_to_exception(const core_error_info& info) diff --git a/src/wrapper/common.hxx b/src/wrapper/common.hxx index 538ffdce..9d96d81b 100644 --- a/src/wrapper/common.hxx +++ b/src/wrapper/common.hxx @@ -46,11 +46,23 @@ COUCHBASE_API ZEND_EXTERN_MODULE_GLOBALS(couchbase) #define COUCHBASE_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(couchbase, v) +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) + +#ifdef COUCHBASE_ABI_VERSION + #define COUCHBASE_NAMESPACE_ABI_SUFFIX "_" TOSTRING(COUCHBASE_ABI_VERSION) +#else + #define COUCHBASE_NAMESPACE_ABI_SUFFIX "" +#endif + namespace couchbase::php { COUCHBASE_API void initialize_exceptions(const zend_function_entry* exception_functions); +COUCHBASE_API void +initialize_exception_aliases(); + COUCHBASE_API zend_class_entry* couchbase_exception(); diff --git a/tests/ABITest.php b/tests/ABITest.php new file mode 100644 index 00000000..4d4effcf --- /dev/null +++ b/tests/ABITest.php @@ -0,0 +1,61 @@ +skipIfNotABI(); + parent::setUp(); + } + + public function testExtensionsLoadedPermutation() { + $abi = getenv('TEST_ABI'); + $unversionedFunc = 'Couchbase\\Extension\\version'; + $versionedFunc = 'Couchbase\\Extension_' . ExtensionNamespaceResolver::COUCHBASE_EXTENSION_VERSION . '\\version'; + if ($abi == "both") { + print_r($unversionedFunc()); + print_r($versionedFunc()); + $this->assertTrue(true); + } else if ($abi == "versioned") { + print_r($versionedFunc()); + $this->assertTrue(true); + } else if ($abi == "unversioned") { + print_r($unversionedFunc()); + $this->assertTrue(true); + } + } + + public function testNamespaceResolver() + { + ExtensionNamespaceResolver::defineExtensionNamespace(); + $abi = getenv('TEST_ABI'); + + if ($abi == "both" || $abi == "unversioned") { + $this->assertEquals("Couchbase\\Extension", COUCHBASE_EXTENSION_NAMESPACE); + } else if ($abi == "versioned") { + $this->assertEquals("Couchbase\\Extension_" . ExtensionNamespaceResolver::COUCHBASE_EXTENSION_VERSION, COUCHBASE_EXTENSION_NAMESPACE); + } + } +} diff --git a/tests/Helpers/CouchbaseTestCase.php b/tests/Helpers/CouchbaseTestCase.php index bcdbc70f..37793f8e 100644 --- a/tests/Helpers/CouchbaseTestCase.php +++ b/tests/Helpers/CouchbaseTestCase.php @@ -144,6 +144,14 @@ public function skipIfProtostellar(): void } } + public function skipIfNotABI(): void + { + $ABI = getenv('TEST_ABI'); + if (!$ABI) { + $this->markTestSkipped("Test is only ran when testing ABI extensioned versions"); + } + } + public function isProtostellar(): bool { if ( diff --git a/tests/Helpers/TestEnvironment.php b/tests/Helpers/TestEnvironment.php index 07c5a24b..c2ca85fb 100644 --- a/tests/Helpers/TestEnvironment.php +++ b/tests/Helpers/TestEnvironment.php @@ -24,6 +24,7 @@ include_once __DIR__ . "/ServerVersion.php"; include_once __DIR__ . "/ConsistencyUtils.php"; +use Couchbase\ExtensionNamespaceResolver; use Couchbase\PasswordAuthenticator; use Exception; use RuntimeException; @@ -41,6 +42,13 @@ class TestEnvironment private static function checkExtension(string $name) { + if ($name == "couchbase") { + $versionedExtension = "couchbase_" . ExtensionNamespaceResolver::COUCHBASE_EXTENSION_VERSION; + if (extension_loaded($versionedExtension)) { + return; + } + } + if (!extension_loaded($name)) { $extension = "couchbase"; $moduleDirectory = realpath(__DIR__ . '/../../modules'); diff --git a/tests/ViewTest.php b/tests/ViewTest.php index ade570bd..448c3346 100644 --- a/tests/ViewTest.php +++ b/tests/ViewTest.php @@ -75,7 +75,8 @@ public function testConsistency() ], ]; - Extension\viewIndexUpsert($this->cluster->core(), $this->bucketName, $ddoc, DesignDocumentNamespace::PRODUCTION, []); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\viewIndexUpsert'; + $function($this->cluster->core(), $this->bucketName, $ddoc, DesignDocumentNamespace::PRODUCTION, []); $this->consistencyUtil()->waitUntilViewPresent($this->bucketName, $ddocName, 'test'); sleep(1); // give design document a second to settle @@ -118,7 +119,8 @@ public function testGrouping() ], ]; - Extension\viewIndexUpsert($this->cluster->core(), $this->bucketName, $ddoc, DesignDocumentNamespace::PRODUCTION, []); + $function = COUCHBASE_EXTENSION_NAMESPACE . '\\viewIndexUpsert'; + $function($this->cluster->core(), $this->bucketName, $ddoc, DesignDocumentNamespace::PRODUCTION, []); $this->consistencyUtil()->waitUntilViewPresent($this->bucketName, $ddocName, 'test'); sleep(1); // give design document a second to settle