Project Page and Repository

http://drupal.org/sandbox/drupwas/1679826
git clone http://git.drupal.org/sandbox/drupwas/1679826.git blockexport
Drupal Version: 7x

Functionality List

  1. It will import all system specific block into a feature.
  2. Import all custom blocks within a feature.
  3. Import all system blocks associated with content type
  4. Import all block roles
  5. No configuration is required.
  6. This module not create any table in your database to minimise the performance issue

Different from others module

  1. It not created any tables due to increase the performance.
  2. Other module have a issue with features(not reverted) and need to configure lots of thing in admin panel.

Installation

Quite simple, Download the module and simply put into your
your_drupal_path/sites/all/modules and install from your admin panel.

Configuration

After successfull installation you able to export your all local box from
Admin >> Structure >> Features >> Create Features

Enter your features name, description, package(optional),
version(optional), URL(optional) and then choose "Block: blockexport_settings"
from edit components drop-down box and then should check
"Block: Export All Blocks" checkbox and then press download button.

Unzip your downloaded file and upload it into your drupal installed remote
server or in any vanila drupal(drupal_root/sites/all/modules) where you want
to import all the exported blocks and enable this module by drush or
from admin.

That's it.

Dependencies

  1. Features (http://drupal.org/project/features)
  2. Ctools (http://drupal.org/project/ctools)

Reviews of other projects

http://drupal.org/node/1684418#comment-6235206
http://drupal.org/node/1098972#comment-6227860
http://drupal.org/node/1102520#comment-6236572

http://drupal.org/node/1673410#comment-6269734
http://drupal.org/node/1682266#comment-6273306
http://drupal.org/node/1679472#comment-6273512

CommentFileSizeAuthor
#6 export_blocks.png97.57 KBbartlantz

Comments

drupwash’s picture

Issue summary: View changes

Different from others module html property changed

drupwash’s picture

Issue summary: View changes

Code script removed

drupwash’s picture

Issue summary: View changes

Repository explanation provided

drupwash’s picture

Issue summary: View changes

Description modified

drupwash’s picture

Issue summary: View changes

Clean repository address added

eleonel’s picture

This module export all the blocks? or only selected blocks?

Good idea!

klausi’s picture

You have listed some reviews in your issue summary, but you did not do any manual reviews? Please read through the source code of other projects and report any issues that you find. And don't forget to add the review bonus tag if you did some actual manual reviews as outlined in #1410826: [META] Review bonus.

drupwash’s picture

@eleonel, thanks a lot to review, right now it port into a feature with all the blocks and I'm working on to feature selected block without creating any extra table.

drupwash’s picture

@klausi, thanks a lot, I will follow, which you mention, it is very use-full. Thanks again.

drupwash’s picture

Issue summary: View changes

Version added

drupwash’s picture

Issue summary: View changes

Review msg changed

drupwash’s picture

Issue summary: View changes

Review added

drupwash’s picture

Issue summary: View changes

Review added

drupwash’s picture

Issue summary: View changes

Review comments added.

drupwash’s picture

Issue tags: +PAreview: review bonus

Needs Review

bartlantz’s picture

Status: Needs review » Needs work
StatusFileSize
new97.57 KB

Hi @drupwash,

This is a great module, very handy! I was able to export all of the blocks from a test site and to import them back into the site. Everything is working correctly.

These are my suggestions for improving it:
1. Add a better description to the block_export.info. For instance:
description: Allows exporting of all blocks as a feature.

2. Add a requirements section to the README.txt for the requirements: Features and Chaos Tools.

3. Add to README.txt that you should check "Block: Export All Blocks" when creating the feature.

4. Add a couple screen shots to the project page. (Creating features can be confusing to end users so a screen shot could help illustrate instructions.) I've attached a picture of the create features page.

Thanks,
Bart

bartlantz’s picture

Status: Needs work » Needs review

I changed the status back to "needs review", because the module works as intended but could just use a couple of documentation fixes. These minor things shouldn't block others from reviewing the module.

Thanks,
Bart

roynilanjan’s picture

Status: Needs review » Needs work

I have gone through the code base it actually works on entire block tables.
As far codes it seems to me very handy module but have one suggestion,
In the blockexport_settings_features_export_render function there are multiple quires to take the all block configuration.
Mostly common queries excepts those table & schema name so please make a class in .inc file
& put the logic in parameterised static function,

$results = db_query("SELECT * FROM ".$schema_name);
foreach ($results as $result) {
$data = array();
$schema = drupal_get_schema($schema_name);
$fields = array_keys($schema['fields']);
foreach ($fields as $field) {
$data[$field] = $result->$field;
}
$code[] = " \$export['$schema_name'][] = " . features_var_export($data) . ";";
}

load the module in info file & then call the function in module like,
Blockexport::methodname('schemaname');

roynilanjan’s picture

Issue summary: View changes

Repository added

drupwash’s picture

Status: Needs work » Needs review
Issue tags: -PAreview: review bonus

Hi @bartlantz,
Thanks for your reply. I have added following things as per your suggestions..
1. Better description added into .info file
2. Dependency description added into README.txt file.
3. Added into README.txt that you should check "Block: Export All Blocks" when creating the feature.
4. Screen-shot and better description added into features page.

drupwash’s picture

Hi @bartlantz,
Thanks for your reply. I have added better documentation in features page as well as in readme.txt also.

drupwash’s picture

Issue tags: +PAreview: review bonus

Hi @roynilanjan,
Thanks a lot for reviewing my code. This is good idea to make a separate class in a .inc file but I have a very minimal code and business logic in .module file and I think it will better to create a private function in .module file instead of class in new .inc file.

I have created following function from your suggestion instead of creating class in .inc file

function _genarateschema($table_to_export) {
  $code = array();
  $code[] = "  \$export = array();";
  foreach($table_to_export as $table) {
    $results = db_query("SELECT * FROM {$table}");
    foreach ($results as $result) {
      $data = array();
      $schema = drupal_get_schema($table);
      $fields = array_keys($schema['fields']);
      foreach ($fields as $field) {
        $data[$field] = $result->$field;
      }
      $code[] = "  \$export['$table'][] = " . features_var_export($data) . ";";
    }
  }
  $code[] = "return \$export;";
  $code = implode("\n", $code);
  return array('default_blockexport_settings' => $code);
}
drupwash’s picture

Issue summary: View changes

Content modified

drupwash’s picture

Issue summary: View changes

Repository added

drupwash’s picture

Issue summary: View changes

Repo modified

drupwash’s picture

Issue summary: View changes

Version added

drupwash’s picture

Issue summary: View changes

Review added

drupwash’s picture

Issue summary: View changes

Review added

drupwash’s picture

Hi @klausi,
I would like if you test my code again or any suggestion appreciated that why I'm not get reviewed by others though I have already reviewed other codes. Thanks in advance.

klausi’s picture

Assigned: drupwash » Unassigned
Status: Needs review » Reviewed & tested by the community
Issue tags: -PAreview: review bonus

Only reviewers should assign issues to themselves.

There is still a master branch, make sure to set the correct default branch: http://drupal.org/node/1659588 . Then remove the master branch, see also step 6 and 7 in http://drupal.org/node/1127732

manual review:

  1. blockexport_settings_features_revert(): you can insert multiple records at once, see Multi-insert form on http://drupal.org/node/310079 then you don't need the loops.
  2. Did you try that module on a large drupal installation with many blocks? I could imagine that there might be scalability issues if there are a lot of block configurations.

Anyway, I find the idea to just dump whole database tables into Features export code kind of creative :-) . Looks RTBC to me. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

mitchell’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for your contribution, drupwash!

I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on irc in #drupal-contribute. So, come hang out and stay involved! Thanks again, and good luck! :)

drupwash’s picture

Thank you very much @klausi and @mitchell for reviewing code and for full project access.
@Klausi I will modify my code as per your suggestions.

drupwash’s picture

Hi @klausi,
Could you give me any suggestion or anything wrong from my-side that I'm not able to seen any downloadable .zip or .tar file in my project page though I have already moved project from sandbox to "Full Project". Thanks in advance.

klausi’s picture

drupwash’s picture

Hi @klausi,
Thanks for your reply. Could you guide me why I have access denied(http://drupal.org/node/add/project_release/1679826) page? when I'm trying to add new release from my project page.

drupwash’s picture

Hi @klausi,
Thanks for your reply. Could you guide me why I have access denied(http://drupal.org/node/add/project_release/1679826) page? when I'm trying to add new release from my project page.

patrickd’s picture

everyone gets this at the moment, probably site-maintenance.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Review added