Skip to content

Commit 4aed9f0

Browse files
thiagooaknikic
authored andcommitted
Move content to PHP5 folder and create redirects
1 parent 31d0166 commit 4aed9f0

29 files changed

+68
-7
lines changed

Book/index.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ PHP 5
77
.. toctree::
88
:maxdepth: 2
99

10-
introduction.rst
11-
build_system.rst
10+
php5/introduction.rst
11+
php5/build_system.rst
1212

1313
* Creating PHP extensions
1414

1515
.. toctree::
1616
:maxdepth: 2
1717

18-
zvals.rst
18+
php5/zvals.rst
1919

2020
* Implementing functions
2121

2222
.. toctree::
2323
:maxdepth: 2
2424

25-
hashtables.rst
26-
classes_objects.rst
25+
php5/hashtables.rst
26+
php5/classes_objects.rst
2727

2828
PHP 7
2929
-----
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Book/zvals/basic_structure.rst renamed to Book/php5/zvals/basic_structure.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ than this would cause an overflow (thus making the length negative).
8282
The remaining three types will only be mentioned here quickly and discussed in greater detail in their own chapters:
8383

8484
Arrays use the ``IS_ARRAY`` type tag and are stored in the ``HashTable *ht`` member. How the ``HashTable`` structure
85-
works will be discussed in the :doc:`/hashtables` chapter.
85+
works will be discussed in the :doc:`/php5/hashtables` chapter.
8686

8787
Objects (``IS_OBJECT``) use the ``zend_object_value obj`` member, which consists of an "object handle", which is an
8888
integer ID used to look up the actual data of the object, and a set of "object handlers", which define how the object
89-
behaves. PHP's class and object system will be described in the :doc:`/classes_objects` chapter.
89+
behaves. PHP's class and object system will be described in the :doc:`/php5/classes_objects` chapter.
9090

9191
Resources (``IS_RESOURCE``) are similar to objects in that they also store a unique ID that can be used to look up the
9292
actual value. This ID is stored in the ``long lval`` member. Resources are covered in the Resources chapter (which

build_html.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
sphinx-build -b html -d doctrees Book BookHTML
2+
php generate_php5_redirects.php

build_release_html.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ rm -f BookHTML/*.html
55
rm -f BookHTML/.buildinfo
66

77
sphinx-build -b html -d doctrees -a Book BookHTML
8+
php generate_php5_redirects.php

generate_php5_redirects.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
// generates html redirect files so that urls do not break with the addition of the php5 folder
4+
5+
$files = [
6+
'introduction.html',
7+
'build_system.html',
8+
'classes_objects.html',
9+
'hashtables.html',
10+
'introduction.html',
11+
'zvals.html',
12+
'build_system/building_extensions.html',
13+
'build_system/building_php.html',
14+
'classes_objects/custom_object_storage.html',
15+
'classes_objects/implementing_typed_arrays.html',
16+
'classes_objects/internal_structures_and_implementation.html',
17+
'classes_objects/iterators.html',
18+
'classes_objects/magic_interfaces_comparable.html',
19+
'classes_objects/object_handlers.html',
20+
'classes_objects/serialization.html',
21+
'classes_objects/simple_classes.html',
22+
'hashtables/array_api.html',
23+
'hashtables/basic_structure.html',
24+
'hashtables/hash_algorithm.html',
25+
'hashtables/hashtable_api.html',
26+
'zvals/basic_structure.html',
27+
'zvals/casts_and_operations.html',
28+
'zvals/memory_management.html',
29+
];
30+
31+
$template = '<!DOCTYPE HTML>
32+
<html>
33+
<head>
34+
<meta charset="UTF-8">
35+
<meta http-equiv="refresh" content="1; url=_URL_">
36+
37+
<script>
38+
window.location.href = "_URL_"
39+
</script>
40+
</head>
41+
<body>
42+
<title>Page Redirection</title>
43+
44+
If you are not redirected automatically, follow <a href="_URL_">this link.</a>
45+
</body>
46+
</html>';
47+
48+
$basePath = __DIR__ . '/BookHTML/';
49+
$baseURL = '/php5/';
50+
51+
foreach ($files as $file) {
52+
$fileName = $basePath . $file;
53+
if (!file_exists(dirname($fileName))) {
54+
mkdir(dirname($fileName));
55+
}
56+
57+
$content = str_replace('_URL_', $baseURL . $file, $template);
58+
file_put_contents($fileName, $content);
59+
}

0 commit comments

Comments
 (0)