Skip to content

Instantly share code, notes, and snippets.

@janus57
Created October 2, 2017 11:26
Show Gist options
  • Save janus57/806b4f0dfd5e10795e0009f50992eeb5 to your computer and use it in GitHub Desktop.
Save janus57/806b4f0dfd5e10795e0009f50992eeb5 to your computer and use it in GitHub Desktop.
Create a patch file for specific files (.css & .tpl) and save it under the same tree
#!/bin/bash
FOLDER_OLD="phpboost_5-0"
FOLDER_NEW="phpboost_5-1"
FOLDER_PATCHES="./patches"
mkdir -p ${FOLDER_PATCHES}
for newfile in `find $FOLDER_NEW -type f -name "*.css" -o -name "*.tpl"`
do
sufix=${newfile#${FOLDER_NEW}/}
oldfile="${FOLDER_OLD}/${sufix}"
if [ -f $oldfile ]; then
patchfile="${FOLDER_PATCHES}/$sufix.patch"
if [ "`diff $oldfile $newfile`" != "" ]; then
echo "Make patch ${patchfile}"
mkdir -p `dirname $patchfile` && diff -dupN "$oldfile" "$newfile" > "$patchfile"
fi
fi
done
Example of patches between PHPBoost 5.0 and 5.1
root@patcher:~# tree patches/
patches/
├── articles
│   └── templates
│   ├── articles.css.patch
│   ├── ArticlesDisplayArticlesController.tpl.patch
│   ├── ArticlesDisplaySeveralArticlesController.tpl.patch
│   └── ArticlesFormFieldSelectSources.tpl.patch
├── BBCode
│   └── templates
│   ├── bbcode.css.patch
│   └── bbcode_editor.tpl.patch
├── calendar
│   └── templates
│   ├── CalendarAjaxEventsController.tpl.patch
│   ├── calendar.css.patch
│   └── CalendarDisplayEventController.tpl.patch
├── connect
│   └── templates
│   ├── connect_mini.css.patch
│   └── connect_mini.tpl.patch
├── contact
│   └── templates
│   ├── ContactController.tpl.patch
│   ├── contact.css.patch
│   ├── ContactFormFieldObjectPossibleValues.tpl.patch
│   └── ContactFormFieldRecipientsPossibleValues.tpl.patch
├── database
│   └── templates
│   ├── admin_database_management.tpl.patch
│   └── admin_database_tools.tpl.patch
├── download
│   └── templates
│   ├── download.css.patch
│   ├── DownloadDisplayDownloadFileController.tpl.patch
│   ├── DownloadDisplaySeveralDownloadFilesController.tpl.patch
│   ├── download_mini.css.patch
│   └── DownloadModuleMiniMenu.tpl.patch
├── faq
│   └── templates
│   ├── faq.css.patch
│   ├── FaqDisplaySeveralFaqQuestionsController.tpl.patch
│   └── FaqModuleMiniMenu.tpl.patch
├── forum
│   └── templates
│   ├── admin_ranks_add.tpl.patch
│   ├── admin_ranks.tpl.patch
│   ├── forum_bottom.tpl.patch
│   ├── forum.css.patch
│   ├── forum_edit_msg.tpl.patch
│   ├── forum_forum.tpl.patch
│   ├── forum_index.tpl.patch
│   ├── forum_membermsg.tpl.patch
│   ├── forum_moderation_panel.tpl.patch
│   ├── forum_post.tpl.patch
│   ├── forum_topic.tpl.patch
│   ├── forum_top.tpl.patch
│   └── forum_track.tpl.patch
├── gallery
│   └── templates
│   ├── admin_gallery_add.tpl.patch
│   ├── admin_gallery_config.tpl.patch
│   ├── admin_gallery_management.tpl.patch
│   ├── gallery_add.tpl.patch
│   ├── gallery_mini.tpl.patch
│   └── gallery.tpl.patch
├── install
│   └── templates
│   ├── install.css.patch
│   ├── main.tpl.patch
│   └── server-config.tpl.patch
├── kernel
│   └── lib
│   └── css
│   └── font-awesome
│   └── css
│   └── font-awesome.css.patch
├── LangsSwitcher
│   └── templates
│   ├── langsswitcher.css.patch
│   └── langswitcher.tpl.patch
├── media
│   └── templates
│   ├── media_action.tpl.patch
│   ├── media.css.patch
│   └── media.tpl.patch
├── news
│   └── templates
│   ├── news.css.patch
│   ├── NewsDisplayNewsController.tpl.patch
│   ├── NewsDisplaySeveralNewsController.tpl.patch
│   └── NewsFormFieldSelectSources.tpl.patch
├── newsletter
│   └── templates
│   └── newsletter_mini.css.patch
├── online
│   └── templates
│   ├── OnlineHomeController.tpl.patch
│   └── OnlineModuleMiniMenu.tpl.patch
├── pages
│   └── templates
│   ├── action.tpl.patch
│   ├── admin_pages.tpl.patch
│   ├── explorer.tpl.patch
│   ├── index.tpl.patch
│   ├── pages.css.patch
│   └── post.tpl.patch
├── poll
│   └── templates
│   ├── admin_poll_add.tpl.patch
│   ├── admin_poll_config.tpl.patch
│   ├── admin_poll_management2.tpl.patch
│   ├── admin_poll_management.tpl.patch
│   ├── poll.css.patch
│   ├── poll_mini.tpl.patch
│   └── poll.tpl.patch
├── QuestionCaptcha
│   └── templates
│   └── QuestionCaptchaFormFieldQuestions.tpl.patch
├── ReCaptcha
│   └── templates
│   └── ReCaptcha.tpl.patch
├── search
│   └── templates
│   ├── admin_search.tpl.patch
│   ├── search.css.patch
│   ├── search_forms.tpl.patch
│   ├── search_mini.css.patch
│   ├── search_mini.tpl.patch
│   └── search_results.tpl.patch
├── shoutbox
│   └── templates
│   ├── ShoutboxAjaxMessagesBoxController.tpl.patch
│   ├── ShoutboxHomeController.tpl.patch
│   ├── shoutbox_mini.css.patch
│   └── ShoutboxModuleMiniMenu.tpl.patch
├── sitemap
│   └── templates
│   └── export
│   └── sitemap.xml.tpl.patch
├── stats
│   └── templates
│   ├── admin_stats_management.tpl.patch
│   ├── stats.css.patch
│   ├── stats_mini.tpl.patch
│   └── stats.tpl.patch
├── templates
│   ├── base
│   │   ├── body.tpl.patch
│   │   ├── frame.tpl.patch
│   │   └── theme
│   │   ├── content.css.patch
│   │   ├── cssmenu.css.patch
│   │   ├── design.css.patch
│   │   ├── form.css.patch
│   │   ├── global.css.patch
│   │   ├── login.css.patch
│   │   └── table.css.patch
│   └── default
│   ├── admin
│   │   ├── admin_files_management.tpl.patch
│   │   ├── admin_files_move.tpl.patch
│   │   ├── admin_groups_management2.tpl.patch
│   │   ├── admin_index.tpl.patch
│   │   ├── body.tpl.patch
│   │   ├── frame.tpl.patch
│   │   ├── langs
│   │   │   ├── AdminLangsInstalledListController.tpl.patch
│   │   │   └── AdminLangsNotInstalledListController.tpl.patch
│   │   ├── member
│   │   │   └── AdminExtendedFieldsMemberlistController.tpl.patch
│   │   ├── menus
│   │   │   ├── content.tpl.patch
│   │   │   ├── links.tpl.patch
│   │   │   ├── menu_edition.tpl.patch
│   │   │   ├── menus.tpl.patch
│   │   │   └── menu.tpl.patch
│   │   ├── modules
│   │   │   ├── AdminModuleAddController.tpl.patch
│   │   │   ├── AdminModulesManagementController.tpl.patch
│   │   │   └── AdminModuleUpdateController.tpl.patch
│   │   └── themes
│   │   ├── AdminThemesInstalledListController.tpl.patch
│   │   └── AdminThemesNotInstalledListController.tpl.patch
│   ├── framework
│   │   ├── builder
│   │   │   ├── form
│   │   │   │   ├── FormFieldActionLinkList.tpl.patch
│   │   │   │   ├── FormFieldAuthorizationsSetter.tpl.patch
│   │   │   │   ├── FormFieldCaptcha.tpl.patch
│   │   │   │   ├── FormFieldCheckbox.tpl.patch
│   │   │   │   ├── FormFieldDate.tpl.patch
│   │   │   │   ├── FormFieldLabel.tpl.patch
│   │   │   │   ├── FormFieldMultiLineTextEditor.tpl.patch
│   │   │   │   ├── FormFieldMultipleAutocompleter.tpl.patch
│   │   │   │   ├── FormFieldMultipleFilePicker.tpl.patch
│   │   │   │   ├── FormFieldMultipleSelectChoice.tpl.patch
│   │   │   │   ├── FormFieldPossibleValues.tpl.patch
│   │   │   │   ├── FormFieldset.tpl.patch
│   │   │   │   ├── FormFieldShortMultiLineTextEditor.tpl.patch
│   │   │   │   ├── FormField.tpl.patch
│   │   │   │   └── FormFieldUploadFile.tpl.patch
│   │   │   └── table
│   │   │   └── HTMLTable.tpl.patch
│   │   ├── content
│   │   │   ├── print.tpl.patch
│   │   │   └── syndication
│   │   │   ├── atom.tpl.patch
│   │   │   └── rss.tpl.patch
│   │   ├── groups_auth.tpl.patch
│   │   ├── helper
│   │   │   └── message.tpl.patch
│   │   ├── menus
│   │   │   ├── content.tpl.patch
│   │   │   ├── feed.tpl.patch
│   │   │   ├── links.tpl.patch
│   │   │   └── modules_mini.tpl.patch
│   │   ├── module
│   │   │   ├── admin_module_actions_links_menu.tpl.patch
│   │   │   ├── module_actions_links_menu.tpl.patch
│   │   │   └── module_actions_link.tpl.patch
│   │   └── util
│   │   ├── mini_calendar.tpl.patch
│   │   └── pagination.tpl.patch
│   ├── js_bottom.tpl.patch
│   ├── js_top.tpl.patch
│   └── theme
│   ├── admin_content.css.patch
│   ├── admin_cssmenu.css.patch
│   ├── admin_design.css.patch
│   ├── admin_form.css.patch
│   ├── admin_global.css.patch
│   ├── admin_menus.css.patch
│   ├── admin_table.css.patch
│   └── default.css.patch
├── ThemesSwitcher
│   └── templates
│   ├── themeswitcher.css.patch
│   └── themeswitcher.tpl.patch
├── TinyMCE
│   └── templates
│   └── tinymce_editor.tpl.patch
├── user
│   └── templates
│   ├── moderation_panel.tpl.patch
│   ├── pm.tpl.patch
│   ├── upload_move.tpl.patch
│   ├── upload.tpl.patch
│   ├── UserExploreGroupsController.tpl.patch
│   ├── UserHomeProfileController.tpl.patch
│   └── UserUsersListController.tpl.patch
├── web
│   └── templates
│   ├── web.css.patch
│   ├── WebDisplaySeveralWebLinksController.tpl.patch
│   ├── WebDisplayWebLinkController.tpl.patch
│   ├── web_mini.css.patch
│   └── WebModuleMiniMenu.tpl.patch
└── wiki
└── templates
├── admin_wiki_groups.tpl.patch
├── admin_wiki.tpl.patch
├── explorer.tpl.patch
├── index.tpl.patch
├── post.tpl.patch
├── property.tpl.patch
├── wiki.css.patch
├── wiki_js_tools.tpl.patch
└── wiki.tpl.patch
85 directories, 182 files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment