SlideShare une entreprise Scribd logo
1  sur  24
VersionPress
The dark side
Why is WordPress
hard?
VersionPress is not an exception – quite the opposite
Biggest Challenges
• GUIDs
• Lack of foreign keys
• Poor database design
• Tracking all changes
• Format for storing data in Git
GUIDs
GUIDs
Foreign keys
Foreign keys
Foreign keys
post:
table: posts
id: ID
references:
post_author: user
post_parent: post
mn-references:
term_relationships.term_taxonomy_id: term_taxonomy
user:
table: users
id: ID
Foreign keys
post:
table: posts
id: ID
references:
post_author: user
post_parent: post
mn-references:
term_relationships.term_taxonomy_id: term_taxonomy
user:
table: users
id: ID
Foreign keys
Foreign keys
Foreign keys
postmeta:
id: meta_id
parent-reference: post_id
references:
post_id: post
value-references:
meta_key@meta_value:
_thumbnail_id: post
Foreign keys
Foreign keys
Poor DB design
“12 tables ought to be enough for anybody”
Tracking all changes
Format
[8CFC6D1208DC4D0F877039A3B8300366]
post_date = "2016-02-11 17:29:03"
post_date_gmt = "2016-02-11 17:29:03"
post_content = "live"
post_content_filtered = “"
post_title = "Added on LIVE"
post_excerpt = ""
post_status = "publish"
post_type = "post"
comment_status = "open"
ping_status = "open"
post_password = ""
post_name = "added-on-live"
to_ping = ""
pinged = ""
menu_order = 0
post_mime_type = ""
guid = "http://3D13C49A-BE86-4C8B-B4ED-D83222FFB296"
vp_post_author = "528E14A1AAD04CC08121DD631B2F6591"
vp_post_parent = 0
vp_term_taxonomy[0] = "752CC32F4AF842A79BEF42454E130743"
GUI
• React + WP-API
• Independent app consuming REST API
GUI – WP-API
register_rest_route($namespace, '/commits', array(
'methods' => WP_REST_Server::READABLE,
'callback' => array($this, 'getCommits'),
'args' => array(
'page' => array(
'default' => '0'
)
),
'permission_callback' => array($this, 'checkPermissions')
));
register_rest_route($namespace, '/undo', array(
'methods' => WP_REST_Server::CREATABLE,
'callback' => array($this, 'undoCommit'),
'args' => array(
'commit' => array(
'required' => true
)
),
'permission_callback' => array($this, 'checkPermissions')
));
GUI – data fetch
WpApi
.get('commits')
.query({page: page})
.on('progress', (e) => progressBar.progress(e.percent))
.end((err: any, res: request.Response) => {
if (err) {
this.setState({
commits: [],
message: HomePage.getErrorMessage(res),
loading: false,
displayUpdateNotice: false
});
} else {
this.setState({
pages: res.body.pages.map(c => c + 1),
commits: res.body.commits as Commit[],
message: null,
loading: false,
displayUpdateNotice: false
});
this.checkUpdate();
}
});
WordPress + Clean Code
Oxymoron?
WordPress + Clean Code
Separate your code
from WordPress
WordPress + Clean Code
Thin layer
between WP and your code
• hooks,
• global variables,
• WP functions
“All great changes are preceded by chaos.”
— Deepak Chopra

Contenu connexe

Similaire à VersionPress - The Dark Side

BEM for Javascript at CampJS III
BEM for Javascript at CampJS IIIBEM for Javascript at CampJS III
BEM for Javascript at CampJS III
Yandex
 
扩展世界上最大的图片Blog社区
扩展世界上最大的图片Blog社区扩展世界上最大的图片Blog社区
扩展世界上最大的图片Blog社区
yiditushe
 
L’architettura di classe enterprise di nuova generazione
L’architettura di classe enterprise di nuova generazioneL’architettura di classe enterprise di nuova generazione
L’architettura di classe enterprise di nuova generazione
MongoDB
 

Similaire à VersionPress - The Dark Side (20)

Recommendation Engines with Ruby and Redis
Recommendation Engines with Ruby and RedisRecommendation Engines with Ruby and Redis
Recommendation Engines with Ruby and Redis
 
Tutorial Expert How-To - Custom properties
Tutorial Expert How-To - Custom propertiesTutorial Expert How-To - Custom properties
Tutorial Expert How-To - Custom properties
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
BEM for Javascript at CampJS III
BEM for Javascript at CampJS IIIBEM for Javascript at CampJS III
BEM for Javascript at CampJS III
 
L’architettura di Classe Enterprise di Nuova Generazione
L’architettura di Classe Enterprise di Nuova GenerazioneL’architettura di Classe Enterprise di Nuova Generazione
L’architettura di Classe Enterprise di Nuova Generazione
 
Advanced front end debugging with ms edge and ms tools
Advanced front end debugging with ms edge and ms toolsAdvanced front end debugging with ms edge and ms tools
Advanced front end debugging with ms edge and ms tools
 
Advanced Schema Design Patterns
Advanced Schema Design PatternsAdvanced Schema Design Patterns
Advanced Schema Design Patterns
 
扩展世界上最大的图片Blog社区
扩展世界上最大的图片Blog社区扩展世界上最大的图片Blog社区
扩展世界上最大的图片Blog社区
 
Fotolog: Scaling the World's Largest Photo Blogging Community
Fotolog: Scaling the World's Largest Photo Blogging CommunityFotolog: Scaling the World's Largest Photo Blogging Community
Fotolog: Scaling the World's Largest Photo Blogging Community
 
L’architettura di classe enterprise di nuova generazione
L’architettura di classe enterprise di nuova generazioneL’architettura di classe enterprise di nuova generazione
L’architettura di classe enterprise di nuova generazione
 
MongodB Internals
MongodB InternalsMongodB Internals
MongodB Internals
 
Learn Learn how to build your mobile back-end with MongoDB
Learn Learn how to build your mobile back-end with MongoDBLearn Learn how to build your mobile back-end with MongoDB
Learn Learn how to build your mobile back-end with MongoDB
 
mariadb.pptx
mariadb.pptxmariadb.pptx
mariadb.pptx
 
How to take advantage of scale out graph in Azure Cosmos DB
How to take advantage of scale out graph in Azure Cosmos DBHow to take advantage of scale out graph in Azure Cosmos DB
How to take advantage of scale out graph in Azure Cosmos DB
 
maksym vlasov - culture of git as roots of your ci
maksym vlasov - culture of git as roots of your cimaksym vlasov - culture of git as roots of your ci
maksym vlasov - culture of git as roots of your ci
 
Socialite, the Open Source Status Feed
Socialite, the Open Source Status FeedSocialite, the Open Source Status Feed
Socialite, the Open Source Status Feed
 
Do it in code! A guide to creating a custom site structure plugin in WordPress.
Do it in code! A guide to creating a custom site structure plugin in WordPress.Do it in code! A guide to creating a custom site structure plugin in WordPress.
Do it in code! A guide to creating a custom site structure plugin in WordPress.
 
Understanding indices
Understanding indicesUnderstanding indices
Understanding indices
 
How to generate customized java 8 code from your database
How to generate customized java 8 code from your databaseHow to generate customized java 8 code from your database
How to generate customized java 8 code from your database
 
Silicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSilicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your database
 

Dernier

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Dernier (20)

WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 

VersionPress - The Dark Side

  • 2. Why is WordPress hard? VersionPress is not an exception – quite the opposite
  • 3. Biggest Challenges • GUIDs • Lack of foreign keys • Poor database design • Tracking all changes • Format for storing data in Git
  • 8. Foreign keys post: table: posts id: ID references: post_author: user post_parent: post mn-references: term_relationships.term_taxonomy_id: term_taxonomy user: table: users id: ID
  • 9. Foreign keys post: table: posts id: ID references: post_author: user post_parent: post mn-references: term_relationships.term_taxonomy_id: term_taxonomy user: table: users id: ID
  • 12. Foreign keys postmeta: id: meta_id parent-reference: post_id references: post_id: post value-references: meta_key@meta_value: _thumbnail_id: post
  • 15. Poor DB design “12 tables ought to be enough for anybody”
  • 17. Format [8CFC6D1208DC4D0F877039A3B8300366] post_date = "2016-02-11 17:29:03" post_date_gmt = "2016-02-11 17:29:03" post_content = "live" post_content_filtered = “" post_title = "Added on LIVE" post_excerpt = "" post_status = "publish" post_type = "post" comment_status = "open" ping_status = "open" post_password = "" post_name = "added-on-live" to_ping = "" pinged = "" menu_order = 0 post_mime_type = "" guid = "http://3D13C49A-BE86-4C8B-B4ED-D83222FFB296" vp_post_author = "528E14A1AAD04CC08121DD631B2F6591" vp_post_parent = 0 vp_term_taxonomy[0] = "752CC32F4AF842A79BEF42454E130743"
  • 18. GUI • React + WP-API • Independent app consuming REST API
  • 19. GUI – WP-API register_rest_route($namespace, '/commits', array( 'methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'getCommits'), 'args' => array( 'page' => array( 'default' => '0' ) ), 'permission_callback' => array($this, 'checkPermissions') )); register_rest_route($namespace, '/undo', array( 'methods' => WP_REST_Server::CREATABLE, 'callback' => array($this, 'undoCommit'), 'args' => array( 'commit' => array( 'required' => true ) ), 'permission_callback' => array($this, 'checkPermissions') ));
  • 20. GUI – data fetch WpApi .get('commits') .query({page: page}) .on('progress', (e) => progressBar.progress(e.percent)) .end((err: any, res: request.Response) => { if (err) { this.setState({ commits: [], message: HomePage.getErrorMessage(res), loading: false, displayUpdateNotice: false }); } else { this.setState({ pages: res.body.pages.map(c => c + 1), commits: res.body.commits as Commit[], message: null, loading: false, displayUpdateNotice: false }); this.checkUpdate(); } });
  • 21. WordPress + Clean Code Oxymoron?
  • 22. WordPress + Clean Code Separate your code from WordPress
  • 23. WordPress + Clean Code Thin layer between WP and your code • hooks, • global variables, • WP functions
  • 24. “All great changes are preceded by chaos.” — Deepak Chopra