Changeset 2744970
- Timestamp:
- 06/20/2022 05:30:42 AM (4 years ago)
- Location:
- on-demand-revalidation
- Files:
-
- 12 edited
- 1 copied
-
tags/1.0.4 (copied) (copied from on-demand-revalidation/trunk)
-
tags/1.0.4/on-demand-revalidation.php (modified) (2 diffs)
-
tags/1.0.4/readme.txt (modified) (3 diffs)
-
tags/1.0.4/vendor/autoload.php (modified) (1 diff)
-
tags/1.0.4/vendor/composer/autoload_real.php (modified) (2 diffs)
-
tags/1.0.4/vendor/composer/autoload_static.php (modified) (2 diffs)
-
tags/1.0.4/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/on-demand-revalidation.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (2 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
on-demand-revalidation/tags/1.0.4/on-demand-revalidation.php
r2744965 r2744970 4 4 * 5 5 * Plugin Name: On-Demand Revalidation 6 * Plugin URI: https:// github.com/gdidentity/on-demand-revalidation6 * Plugin URI: https://wordpress.org/plugins/on-demand-revalidation 7 7 * GitHub Plugin URI: https://github.com/gdidentity/on-demand-revalidation 8 8 * Description: Next.js On-Demand Revalidation on the post update, revalidate specific paths on the post update. 9 * Version: 1.0. 39 * Version: 1.0.4 10 10 * Author: GD IDENTITY 11 11 * Author URI: https://gdidentity.sk … … 116 116 // Plugin version. 117 117 if ( ! defined( 'ON_DEMAND_REVALIDATION_VERSION' ) ) { 118 define( 'ON_DEMAND_REVALIDATION_VERSION', '1.0. 3' );118 define( 'ON_DEMAND_REVALIDATION_VERSION', '1.0.4' ); 119 119 } 120 120 -
on-demand-revalidation/tags/1.0.4/readme.txt
r2744965 r2744970 4 4 Requires at least: 4.7 5 5 Tested up to: 6.0 6 Stable tag: 1.0. 36 Stable tag: 1.0.4 7 7 Requires PHP: 5.6 8 8 License: GPL-3 … … 13 13 Next.js On-Demand Revalidation for Wordpress on the post update, revalidate specific paths on the post update. 14 14 15 Feel free to create PR to https://github.com/gdidentity/on-demand-revalidation. 16 15 17 == Installation == 16 18 … … 18 20 2. Click the “Install Now” button, followed by "Activate". 19 21 3. Add Next.js URL and Revalidate Secret Key in the Settings -> Next.js On-Demand Revalidation 20 4. In your Next.js project add new file `/pages/api/revalidate.ts` with this code: 21 ``` 22 import { NextApiRequest, NextApiResponse } from "next" 23 24 export default async function handler(req: NextApiRequest, res: NextApiResponse) { 25 const { 26 body: { paths }, 27 method, 28 } = req 29 30 if (req.headers.authorization !== `Bearer ${process.env.REVALIDATE_SECRET_KEY}`) { 31 return res.status(401).json({ message: 'Invalid token' }) 32 } 33 34 if (method !== 'PUT') { 35 return res.status(405).json({ message: `Method ${method} Not Allowed` }) 36 } 37 38 if (!paths) { 39 return res.status(412).json({ message: 'No paths' }) 40 } 41 42 try { 43 const revalidatePaths = paths 44 .filter((path: string) => path.startsWith('/')) 45 .map((path: string) => res.unstable_revalidate( 46 path, 47 { unstable_onlyGenerated: false } 48 )); 49 50 await Promise.all(revalidatePaths); 51 52 return res.json({ revalidated: true, message: 'Paths revalidated' }) 53 54 } catch (err) { 55 56 return res.status(500).json({ message: err.message }) 57 } 58 } 59 ``` 22 4. In your Next.js project add a new file `/pages/api/revalidate.ts` with a code snippet, you'll find [here](https://github.com/gdidentity/on-demand-revalidation). 60 23 5. Add `REVALIDATE_SECRET_KEY` env variable to your Next.js with Revalidate Secret Key value you added in the Plugin Settings. 61 24 62 === Development ===63 64 Feel free to create PR to https://github.com/gdidentity/on-demand-revalidation.65 25 66 26 == Changelog == 67 27 68 69 = 1.0.3 = 28 = 1.0.4 = 70 29 - publish plugin -
on-demand-revalidation/tags/1.0.4/vendor/autoload.php
r2744965 r2744970 10 10 require_once __DIR__ . '/composer/autoload_real.php'; 11 11 12 return ComposerAutoloaderInit bf69715a6cfc144ba848678e0a080558::getLoader();12 return ComposerAutoloaderInite7e9d8b9dcc139583013a53e85289027::getLoader(); -
on-demand-revalidation/tags/1.0.4/vendor/composer/autoload_real.php
r2744965 r2744970 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit bf69715a6cfc144ba848678e0a0805585 class ComposerAutoloaderInite7e9d8b9dcc139583013a53e85289027 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 spl_autoload_register(array('ComposerAutoloaderInit bf69715a6cfc144ba848678e0a080558', 'loadClassLoader'), true, true);25 spl_autoload_register(array('ComposerAutoloaderInite7e9d8b9dcc139583013a53e85289027', 'loadClassLoader'), true, true); 26 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 27 spl_autoload_unregister(array('ComposerAutoloaderInit bf69715a6cfc144ba848678e0a080558', 'loadClassLoader'));27 spl_autoload_unregister(array('ComposerAutoloaderInite7e9d8b9dcc139583013a53e85289027', 'loadClassLoader')); 28 28 29 29 require __DIR__ . '/autoload_static.php'; 30 call_user_func(\Composer\Autoload\ComposerStaticInit bf69715a6cfc144ba848678e0a080558::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInite7e9d8b9dcc139583013a53e85289027::getInitializer($loader)); 31 31 32 32 $loader->register(true); -
on-demand-revalidation/tags/1.0.4/vendor/composer/autoload_static.php
r2744965 r2744970 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit bf69715a6cfc144ba848678e0a0805587 class ComposerStaticInite7e9d8b9dcc139583013a53e85289027 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 32 32 { 33 33 return \Closure::bind(function () use ($loader) { 34 $loader->prefixLengthsPsr4 = ComposerStaticInit bf69715a6cfc144ba848678e0a080558::$prefixLengthsPsr4;35 $loader->prefixDirsPsr4 = ComposerStaticInit bf69715a6cfc144ba848678e0a080558::$prefixDirsPsr4;36 $loader->classMap = ComposerStaticInit bf69715a6cfc144ba848678e0a080558::$classMap;34 $loader->prefixLengthsPsr4 = ComposerStaticInite7e9d8b9dcc139583013a53e85289027::$prefixLengthsPsr4; 35 $loader->prefixDirsPsr4 = ComposerStaticInite7e9d8b9dcc139583013a53e85289027::$prefixDirsPsr4; 36 $loader->classMap = ComposerStaticInite7e9d8b9dcc139583013a53e85289027::$classMap; 37 37 38 38 }, null, ClassLoader::class); -
on-demand-revalidation/tags/1.0.4/vendor/composer/installed.php
r2744965 r2744970 2 2 'root' => array( 3 3 'name' => 'gdidentity/on-demand-revalidation', 4 'pretty_version' => '1.0. 3',5 'version' => '1.0. 3.0',6 'reference' => ' 875ff3bf5d16ce060fc4121195354ed6cb7e840c',4 'pretty_version' => '1.0.4', 5 'version' => '1.0.4.0', 6 'reference' => '57a9a95c230180e9d82010b0f91d38ef579edb69', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 'gdidentity/on-demand-revalidation' => array( 14 'pretty_version' => '1.0. 3',15 'version' => '1.0. 3.0',16 'reference' => ' 875ff3bf5d16ce060fc4121195354ed6cb7e840c',14 'pretty_version' => '1.0.4', 15 'version' => '1.0.4.0', 16 'reference' => '57a9a95c230180e9d82010b0f91d38ef579edb69', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../', -
on-demand-revalidation/trunk/on-demand-revalidation.php
r2744965 r2744970 4 4 * 5 5 * Plugin Name: On-Demand Revalidation 6 * Plugin URI: https:// github.com/gdidentity/on-demand-revalidation6 * Plugin URI: https://wordpress.org/plugins/on-demand-revalidation 7 7 * GitHub Plugin URI: https://github.com/gdidentity/on-demand-revalidation 8 8 * Description: Next.js On-Demand Revalidation on the post update, revalidate specific paths on the post update. 9 * Version: 1.0. 39 * Version: 1.0.4 10 10 * Author: GD IDENTITY 11 11 * Author URI: https://gdidentity.sk … … 116 116 // Plugin version. 117 117 if ( ! defined( 'ON_DEMAND_REVALIDATION_VERSION' ) ) { 118 define( 'ON_DEMAND_REVALIDATION_VERSION', '1.0. 3' );118 define( 'ON_DEMAND_REVALIDATION_VERSION', '1.0.4' ); 119 119 } 120 120 -
on-demand-revalidation/trunk/readme.txt
r2744965 r2744970 4 4 Requires at least: 4.7 5 5 Tested up to: 6.0 6 Stable tag: 1.0. 36 Stable tag: 1.0.4 7 7 Requires PHP: 5.6 8 8 License: GPL-3 … … 13 13 Next.js On-Demand Revalidation for Wordpress on the post update, revalidate specific paths on the post update. 14 14 15 Feel free to create PR to https://github.com/gdidentity/on-demand-revalidation. 16 15 17 == Installation == 16 18 … … 18 20 2. Click the “Install Now” button, followed by "Activate". 19 21 3. Add Next.js URL and Revalidate Secret Key in the Settings -> Next.js On-Demand Revalidation 20 4. In your Next.js project add new file `/pages/api/revalidate.ts` with this code: 21 ``` 22 import { NextApiRequest, NextApiResponse } from "next" 23 24 export default async function handler(req: NextApiRequest, res: NextApiResponse) { 25 const { 26 body: { paths }, 27 method, 28 } = req 29 30 if (req.headers.authorization !== `Bearer ${process.env.REVALIDATE_SECRET_KEY}`) { 31 return res.status(401).json({ message: 'Invalid token' }) 32 } 33 34 if (method !== 'PUT') { 35 return res.status(405).json({ message: `Method ${method} Not Allowed` }) 36 } 37 38 if (!paths) { 39 return res.status(412).json({ message: 'No paths' }) 40 } 41 42 try { 43 const revalidatePaths = paths 44 .filter((path: string) => path.startsWith('/')) 45 .map((path: string) => res.unstable_revalidate( 46 path, 47 { unstable_onlyGenerated: false } 48 )); 49 50 await Promise.all(revalidatePaths); 51 52 return res.json({ revalidated: true, message: 'Paths revalidated' }) 53 54 } catch (err) { 55 56 return res.status(500).json({ message: err.message }) 57 } 58 } 59 ``` 22 4. In your Next.js project add a new file `/pages/api/revalidate.ts` with a code snippet, you'll find [here](https://github.com/gdidentity/on-demand-revalidation). 60 23 5. Add `REVALIDATE_SECRET_KEY` env variable to your Next.js with Revalidate Secret Key value you added in the Plugin Settings. 61 24 62 === Development ===63 64 Feel free to create PR to https://github.com/gdidentity/on-demand-revalidation.65 25 66 26 == Changelog == 67 27 68 69 = 1.0.3 = 28 = 1.0.4 = 70 29 - publish plugin -
on-demand-revalidation/trunk/vendor/autoload.php
r2744965 r2744970 10 10 require_once __DIR__ . '/composer/autoload_real.php'; 11 11 12 return ComposerAutoloaderInit bf69715a6cfc144ba848678e0a080558::getLoader();12 return ComposerAutoloaderInite7e9d8b9dcc139583013a53e85289027::getLoader(); -
on-demand-revalidation/trunk/vendor/composer/autoload_real.php
r2744965 r2744970 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit bf69715a6cfc144ba848678e0a0805585 class ComposerAutoloaderInite7e9d8b9dcc139583013a53e85289027 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 spl_autoload_register(array('ComposerAutoloaderInit bf69715a6cfc144ba848678e0a080558', 'loadClassLoader'), true, true);25 spl_autoload_register(array('ComposerAutoloaderInite7e9d8b9dcc139583013a53e85289027', 'loadClassLoader'), true, true); 26 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 27 spl_autoload_unregister(array('ComposerAutoloaderInit bf69715a6cfc144ba848678e0a080558', 'loadClassLoader'));27 spl_autoload_unregister(array('ComposerAutoloaderInite7e9d8b9dcc139583013a53e85289027', 'loadClassLoader')); 28 28 29 29 require __DIR__ . '/autoload_static.php'; 30 call_user_func(\Composer\Autoload\ComposerStaticInit bf69715a6cfc144ba848678e0a080558::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInite7e9d8b9dcc139583013a53e85289027::getInitializer($loader)); 31 31 32 32 $loader->register(true); -
on-demand-revalidation/trunk/vendor/composer/autoload_static.php
r2744965 r2744970 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit bf69715a6cfc144ba848678e0a0805587 class ComposerStaticInite7e9d8b9dcc139583013a53e85289027 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 32 32 { 33 33 return \Closure::bind(function () use ($loader) { 34 $loader->prefixLengthsPsr4 = ComposerStaticInit bf69715a6cfc144ba848678e0a080558::$prefixLengthsPsr4;35 $loader->prefixDirsPsr4 = ComposerStaticInit bf69715a6cfc144ba848678e0a080558::$prefixDirsPsr4;36 $loader->classMap = ComposerStaticInit bf69715a6cfc144ba848678e0a080558::$classMap;34 $loader->prefixLengthsPsr4 = ComposerStaticInite7e9d8b9dcc139583013a53e85289027::$prefixLengthsPsr4; 35 $loader->prefixDirsPsr4 = ComposerStaticInite7e9d8b9dcc139583013a53e85289027::$prefixDirsPsr4; 36 $loader->classMap = ComposerStaticInite7e9d8b9dcc139583013a53e85289027::$classMap; 37 37 38 38 }, null, ClassLoader::class); -
on-demand-revalidation/trunk/vendor/composer/installed.php
r2744965 r2744970 2 2 'root' => array( 3 3 'name' => 'gdidentity/on-demand-revalidation', 4 'pretty_version' => '1.0. 3',5 'version' => '1.0. 3.0',6 'reference' => ' 875ff3bf5d16ce060fc4121195354ed6cb7e840c',4 'pretty_version' => '1.0.4', 5 'version' => '1.0.4.0', 6 'reference' => '57a9a95c230180e9d82010b0f91d38ef579edb69', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 'gdidentity/on-demand-revalidation' => array( 14 'pretty_version' => '1.0. 3',15 'version' => '1.0. 3.0',16 'reference' => ' 875ff3bf5d16ce060fc4121195354ed6cb7e840c',14 'pretty_version' => '1.0.4', 15 'version' => '1.0.4.0', 16 'reference' => '57a9a95c230180e9d82010b0f91d38ef579edb69', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.