function ensureWpContentFolder(project) {
    return new Promise((resolve, reject) => {
      const wordpressPath = project.path + '/wordpress';
      let wpContentCreated = false;

      /** Ensure that the /wp-content folder exists */
      if (fs.readdirSync(wordpressPath).indexOf('wp-content') === -1) {
        console.log('No /wp-content folder found, created one.');
        fs.mkdirSync(wordpressPath + '/wp-content');
        wpContentCreated = true;
      }

      /** Ensure that the /wp-content/plugins folder exists */
      if (fs.readdirSync(wordpressPath + '/wp-content').indexOf('plugins') === -1) {
        if (!wpContentCreated) console.log('No /plugins folder found in the /wp-content folder, created one.');
        fs.mkdirSync(wordpressPath + '/wp-content/plugins');
        fs.writeFileSync(wordpressPath + '/wp-content/plugins/index.php', silenceIsGolden);
      }

      /** Ensure that the /wp-content/themes folder exists */
      if (fs.readdirSync(wordpressPath + '/wp-content').indexOf('themes') === -1) {
        if (!wpContentCreated) console.log('No /themes folder found in the /wp-content folder, created one.');
        fs.mkdirSync(wordpressPath + '/wp-content/themes');
        fs.writeFileSync(wordpressPath + '/wp-content/themes/index.php', silenceIsGolden);
      }

      resolve();
    });
  }
/** Ensure that the whole /wp-content folder (incl. sub folders) exists */
Ensure that the whole /wp-content folder (incl. sub folders) exists
Ensure that the whole / wp - content folder ( incl . sub folders ) exists
function ensureWpContentFolder(project) {
    return new Promise((resolve, reject) => {
      const wordpressPath = project.path + '/wordpress';
      let wpContentCreated = false;
      if (fs.readdirSync(wordpressPath).indexOf('wp-content') === -1) {
        console.log('No /wp-content folder found, created one.');
        fs.mkdirSync(wordpressPath + '/wp-content');
        wpContentCreated = true;
      }
      if (fs.readdirSync(wordpressPath + '/wp-content').indexOf('plugins') === -1) {
        if (!wpContentCreated) console.log('No /plugins folder found in the /wp-content folder, created one.');
        fs.mkdirSync(wordpressPath + '/wp-content/plugins');
        fs.writeFileSync(wordpressPath + '/wp-content/plugins/index.php', silenceIsGolden);
      }
      if (fs.readdirSync(wordpressPath + '/wp-content').indexOf('themes') === -1) {
        if (!wpContentCreated) console.log('No /themes folder found in the /wp-content folder, created one.');
        fs.mkdirSync(wordpressPath + '/wp-content/themes');
        fs.writeFileSync(wordpressPath + '/wp-content/themes/index.php', silenceIsGolden);
      }
      resolve();
    });
  }
function ensureWpContentFolder ( project ) { return new Promise ( ( resolve , reject ) => { const wordpressPath = project . path + '/wordpress' ; let wpContentCreated = false ; if ( fs . readdirSync ( wordpressPath ) . indexOf ( 'wp-content' ) === - 1 ) { console . log ( 'No /wp-content folder found, created one.' ) ; fs . mkdirSync ( wordpressPath + '/wp-content' ) ; wpContentCreated = true ; } if ( fs . readdirSync ( wordpressPath + '/wp-content' ) . indexOf ( 'plugins' ) === - 1 ) { if ( ! wpContentCreated ) console . log ( 'No /plugins folder found in the /wp-content folder, created one.' ) ; fs . mkdirSync ( wordpressPath + '/wp-content/plugins' ) ; fs . writeFileSync ( wordpressPath + '/wp-content/plugins/index.php' , silenceIsGolden ) ; } if ( fs . readdirSync ( wordpressPath + '/wp-content' ) . indexOf ( 'themes' ) === - 1 ) { if ( ! wpContentCreated ) console . log ( 'No /themes folder found in the /wp-content folder, created one.' ) ; fs . mkdirSync ( wordpressPath + '/wp-content/themes' ) ; fs . writeFileSync ( wordpressPath + '/wp-content/themes/index.php' , silenceIsGolden ) ; } resolve ( ) ; } ) ; }
Ensure that the whole /wp-content folder (incl.
Ensure that the whole / wp - content folder ( incl .
/** Ensure that the /wp-content folder exists */ /** Ensure that the /wp-content/plugins folder exists */ /** Ensure that the /wp-content/themes folder exists */