Uname: Linux webm012.cluster130.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Software: Apache
PHP version: 8.0.30 [ PHP INFO ] PHP os: Linux
Server Ip: 145.239.37.162
Your Ip: 216.73.216.190
User: dreampi (1009562) | Group: users (100)
Safe Mode: OFF
Disable Function:
_dyuweyrj4,_dyuweyrj4r,dl

name : upgrades.php
<?php
namespace Mtphr\PostDuplicator\Upgrages;
use function Mtphr\PostDuplicator\get_option_value;

add_action( 'admin_init', __NAMESPACE__ . '\run_updates' );

/**
 * Run updates
 *
 * @since  1.0.0
 * @return void
 */
function run_updates() {
  $current_version = get_option( 'mtphr_postduplicator_version', '0' );
  if ( ! $current_version ) {
    $current_version = '0';
  }
  
	if ( version_compare( $current_version, '2.41', '<' ) ) {
    update_v2_41();
	}

	if ( MTPHR_POST_DUPLICATOR_VERSION != $current_version ) {
		update_option( 'mtphr_postduplicator_version_upgraded_from', $current_version );
		update_option( 'mtphr_postduplicator_version', MTPHR_POST_DUPLICATOR_VERSION );
	}
}

/**
 * Version 2.41 updates
 */
function update_v2_41() {
  $duplicate_roles = [
    'administrator',
    'editor',
    'author',
    'contributor',
  ];
  $duplicate_others_roles = [
    'administrator',
  ];
  if ( 'all_users' === get_option_value( 'post_duplication' ) ) {
    $duplicate_others_roles[] = 'editor';
  }

  if ( is_array( $duplicate_roles ) && ! empty( $duplicate_roles ) ) {
    foreach ( $duplicate_roles as $slug ) {
      if ( $role = get_role( $slug ) ) {
        $role->add_cap( 'duplicate_posts' );
        if ( in_array( $slug, $duplicate_others_roles ) ) {
          $role->add_cap( 'duplicate_others_posts' );
        }
      }
    }
  }
}
© 2026 GrazzMean-Shell